aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-07-13 13:37:10 +0200
committerChocobozzz <me@florianbigard.com>2023-07-17 11:31:46 +0200
commit28dd2f14f5bdfd4781e489c42db6eaa7d40d560b (patch)
treec46a1b3f1df55e1ab80eab9e651784ddb91bde9c /client
parent930e1b939a8f4bdc6586eb5bc1fc531e6c13bfcd (diff)
downloadPeerTube-28dd2f14f5bdfd4781e489c42db6eaa7d40d560b.tar.gz
PeerTube-28dd2f14f5bdfd4781e489c42db6eaa7d40d560b.tar.zst
PeerTube-28dd2f14f5bdfd4781e489c42db6eaa7d40d560b.zip
Some player fixes on Android, Safari and iOS
Diffstat (limited to 'client')
-rw-r--r--client/e2e/src/po/video-watch.po.ts5
-rw-r--r--client/e2e/src/suites-all/private-videos.e2e-spec.ts2
-rw-r--r--client/e2e/wdio.local-test.conf.ts2
-rw-r--r--client/src/assets/player/peertube-player.ts4
-rw-r--r--client/src/assets/player/shared/peertube/peertube-plugin.ts8
-rw-r--r--client/src/assets/player/shared/web-video/web-video-plugin.ts3
-rw-r--r--client/src/assets/player/types/peertube-videojs-typings.ts2
-rw-r--r--client/src/sass/player/peertube-skin.scss8
8 files changed, 22 insertions, 12 deletions
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
index 56870511d..76ac58e48 100644
--- a/client/e2e/src/po/video-watch.po.ts
+++ b/client/e2e/src/po/video-watch.po.ts
@@ -9,11 +9,12 @@ export class VideoWatchPage {
9 waitWatchVideoName (videoName: string) { 9 waitWatchVideoName (videoName: string) {
10 if (this.isSafari) return browserSleep(5000) 10 if (this.isSafari) return browserSleep(5000)
11 11
12 // On mobile we display the first node, on desktop the second 12 // On mobile we display the first node, on desktop the second one
13 const index = this.isMobileDevice ? 0 : 1 13 const index = this.isMobileDevice ? 0 : 1
14 14
15 return browser.waitUntil(async () => { 15 return browser.waitUntil(async () => {
16 return (await $$('.video-info .video-info-name')[index].getText()).includes(videoName) 16 return await $('.video-info .video-info-name').isExisting() &&
17 (await $$('.video-info .video-info-name')[index].getText()).includes(videoName)
17 }) 18 })
18 } 19 }
19 20
diff --git a/client/e2e/src/suites-all/private-videos.e2e-spec.ts b/client/e2e/src/suites-all/private-videos.e2e-spec.ts
index 829d76a84..0c3757d0d 100644
--- a/client/e2e/src/suites-all/private-videos.e2e-spec.ts
+++ b/client/e2e/src/suites-all/private-videos.e2e-spec.ts
@@ -31,7 +31,7 @@ describe('Private videos all workflow', () => {
31 return loginPage.loginOnPeerTube2() 31 return loginPage.loginOnPeerTube2()
32 }) 32 })
33 33
34 it('Should play an internal web video video', async () => { 34 it('Should play an internal web video', async () => {
35 await go(FIXTURE_URLS.INTERNAL_WEB_VIDEO) 35 await go(FIXTURE_URLS.INTERNAL_WEB_VIDEO)
36 36
37 await videoWatchPage.waitWatchVideoName(internalVideoName) 37 await videoWatchPage.waitWatchVideoName(internalVideoName)
diff --git a/client/e2e/wdio.local-test.conf.ts b/client/e2e/wdio.local-test.conf.ts
index 96ddc67ca..a691147ca 100644
--- a/client/e2e/wdio.local-test.conf.ts
+++ b/client/e2e/wdio.local-test.conf.ts
@@ -28,7 +28,7 @@ module.exports = {
28 'browserName': 'chrome', 28 'browserName': 'chrome',
29 'acceptInsecureCerts': true, 29 'acceptInsecureCerts': true,
30 'goog:chromeOptions': { 30 'goog:chromeOptions': {
31 args: [ '--disable-gpu', windowSizeArg ], 31 args: [ '--headless', '--disable-gpu', windowSizeArg ],
32 prefs 32 prefs
33 } 33 }
34 }, 34 },
diff --git a/client/src/assets/player/peertube-player.ts b/client/src/assets/player/peertube-player.ts
index a7a2b4065..ebb79247a 100644
--- a/client/src/assets/player/peertube-player.ts
+++ b/client/src/assets/player/peertube-player.ts
@@ -360,7 +360,9 @@ export class PeerTubePlayer {
360 videoCaptions: () => this.currentLoadOptions.videoCaptions, 360 videoCaptions: () => this.currentLoadOptions.videoCaptions,
361 isLive: () => this.currentLoadOptions.isLive, 361 isLive: () => this.currentLoadOptions.isLive,
362 videoUUID: () => this.currentLoadOptions.videoUUID, 362 videoUUID: () => this.currentLoadOptions.videoUUID,
363 subtitle: () => this.currentLoadOptions.subtitle 363 subtitle: () => this.currentLoadOptions.subtitle,
364
365 poster: () => this.currentLoadOptions.poster
364 }, 366 },
365 metrics: { 367 metrics: {
366 mode: () => this.currentLoadOptions.mode, 368 mode: () => this.currentLoadOptions.mode,
diff --git a/client/src/assets/player/shared/peertube/peertube-plugin.ts b/client/src/assets/player/shared/peertube/peertube-plugin.ts
index f52ec75f4..7e5a3ebb6 100644
--- a/client/src/assets/player/shared/peertube/peertube-plugin.ts
+++ b/client/src/assets/player/shared/peertube/peertube-plugin.ts
@@ -1,7 +1,7 @@
1import debug from 'debug' 1import debug from 'debug'
2import videojs from 'video.js' 2import videojs from 'video.js'
3import { logger } from '@root-helpers/logger' 3import { logger } from '@root-helpers/logger'
4import { isIOS, isMobile } from '@root-helpers/web-browser' 4import { isIOS, isMobile, isSafari } from '@root-helpers/web-browser'
5import { timeToInt } from '@shared/core-utils' 5import { timeToInt } from '@shared/core-utils'
6import { VideoView, VideoViewEvent } from '@shared/models/videos' 6import { VideoView, VideoViewEvent } from '@shared/models/videos'
7import { 7import {
@@ -63,8 +63,10 @@ class PeerTubePlugin extends Plugin {
63 63
64 this.player.removeClass('vjs-has-autoplay') 64 this.player.removeClass('vjs-has-autoplay')
65 65
66 // Fix a bug on iOS where the big play button is not displayed when autoplay fails 66 this.player.poster(options.poster())
67 if (isIOS()) this.player.hasStarted(false) 67
68 // Fix a bug on iOS/Safari where the big play button is not displayed when autoplay fails
69 if (isIOS() || isSafari()) this.player.hasStarted(false)
68 }) 70 })
69 71
70 this.player.on('ratechange', () => { 72 this.player.on('ratechange', () => {
diff --git a/client/src/assets/player/shared/web-video/web-video-plugin.ts b/client/src/assets/player/shared/web-video/web-video-plugin.ts
index 80e56795b..930b5045a 100644
--- a/client/src/assets/player/shared/web-video/web-video-plugin.ts
+++ b/client/src/assets/player/shared/web-video/web-video-plugin.ts
@@ -77,6 +77,9 @@ class WebVideoPlugin extends Plugin {
77 77
78 const oldAutoplayValue = this.player.autoplay() 78 const oldAutoplayValue = this.player.autoplay()
79 if (options.isUserResolutionChange) { 79 if (options.isUserResolutionChange) {
80 // Prevent video source element displaying the poster when we change the resolution
81 (this.player.el() as HTMLVideoElement).poster = ''
82
80 this.player.autoplay(false) 83 this.player.autoplay(false)
81 this.player.addClass('vjs-updating-resolution') 84 this.player.addClass('vjs-updating-resolution')
82 } 85 }
diff --git a/client/src/assets/player/types/peertube-videojs-typings.ts b/client/src/assets/player/types/peertube-videojs-typings.ts
index f10fc03a8..adaa43d77 100644
--- a/client/src/assets/player/types/peertube-videojs-typings.ts
+++ b/client/src/assets/player/types/peertube-videojs-typings.ts
@@ -120,6 +120,8 @@ type PeerTubePluginOptions = {
120 isLive: () => boolean 120 isLive: () => boolean
121 videoUUID: () => string 121 videoUUID: () => string
122 subtitle: () => string 122 subtitle: () => string
123
124 poster: () => string
123} 125}
124 126
125type MetricsPluginOptions = { 127type MetricsPluginOptions = {
diff --git a/client/src/sass/player/peertube-skin.scss b/client/src/sass/player/peertube-skin.scss
index 572ae7050..6610512e2 100644
--- a/client/src/sass/player/peertube-skin.scss
+++ b/client/src/sass/player/peertube-skin.scss
@@ -88,13 +88,13 @@ body {
88 &.vjs-has-autoplay:not(.vjs-has-started), 88 &.vjs-has-autoplay:not(.vjs-has-started),
89 &.vjs-updating-resolution { 89 &.vjs-updating-resolution {
90 .vjs-poster { 90 .vjs-poster {
91 opacity: 0; 91 display: none !important;
92 visibility: hidden;
93 } 92 }
94 } 93 }
95 94
96 // Hide the big play button on autoplay 95 // Hide the big play button on autoplay or resolution change
97 &.vjs-has-autoplay { 96 &.vjs-has-autoplay,
97 &.vjs-updating-resolution {
98 .vjs-big-play-button { 98 .vjs-big-play-button {
99 display: none !important; 99 display: none !important;
100 } 100 }