diff options
author | Chocobozzz <me@florianbigard.com> | 2023-07-13 13:37:10 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-07-17 11:31:46 +0200 |
commit | 28dd2f14f5bdfd4781e489c42db6eaa7d40d560b (patch) | |
tree | c46a1b3f1df55e1ab80eab9e651784ddb91bde9c | |
parent | 930e1b939a8f4bdc6586eb5bc1fc531e6c13bfcd (diff) | |
download | PeerTube-28dd2f14f5bdfd4781e489c42db6eaa7d40d560b.tar.gz PeerTube-28dd2f14f5bdfd4781e489c42db6eaa7d40d560b.tar.zst PeerTube-28dd2f14f5bdfd4781e489c42db6eaa7d40d560b.zip |
Some player fixes on Android, Safari and iOS
9 files changed, 26 insertions, 16 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 @@ | |||
1 | import debug from 'debug' | 1 | import debug from 'debug' |
2 | import videojs from 'video.js' | 2 | import videojs from 'video.js' |
3 | import { logger } from '@root-helpers/logger' | 3 | import { logger } from '@root-helpers/logger' |
4 | import { isIOS, isMobile } from '@root-helpers/web-browser' | 4 | import { isIOS, isMobile, isSafari } from '@root-helpers/web-browser' |
5 | import { timeToInt } from '@shared/core-utils' | 5 | import { timeToInt } from '@shared/core-utils' |
6 | import { VideoView, VideoViewEvent } from '@shared/models/videos' | 6 | import { VideoView, VideoViewEvent } from '@shared/models/videos' |
7 | import { | 7 | import { |
@@ -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 | ||
125 | type MetricsPluginOptions = { | 127 | type 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 | } |
diff --git a/server/tests/api/videos/videos-common-filters.ts b/server/tests/api/videos/videos-common-filters.ts index 73c066bfb..ba861164b 100644 --- a/server/tests/api/videos/videos-common-filters.ts +++ b/server/tests/api/videos/videos-common-filters.ts | |||
@@ -469,8 +469,8 @@ describe('Test videos filter', function () { | |||
469 | const finderFactory = (name: string) => (videos: Video[]) => videos.some(v => v.name === name) | 469 | const finderFactory = (name: string) => (videos: Video[]) => videos.some(v => v.name === name) |
470 | 470 | ||
471 | await servers[0].config.enableTranscoding(true, false) | 471 | await servers[0].config.enableTranscoding(true, false) |
472 | await servers[0].videos.upload({ attributes: { name: 'web video video' } }) | 472 | await servers[0].videos.upload({ attributes: { name: 'web video' } }) |
473 | const hasWebVideo = finderFactory('web video video') | 473 | const hasWebVideo = finderFactory('web video') |
474 | 474 | ||
475 | await waitJobs(servers) | 475 | await waitJobs(servers) |
476 | 476 | ||
@@ -481,8 +481,8 @@ describe('Test videos filter', function () { | |||
481 | await waitJobs(servers) | 481 | await waitJobs(servers) |
482 | 482 | ||
483 | await servers[0].config.enableTranscoding(true, true) | 483 | await servers[0].config.enableTranscoding(true, true) |
484 | await servers[0].videos.upload({ attributes: { name: 'hls and web video video' } }) | 484 | await servers[0].videos.upload({ attributes: { name: 'hls and web video' } }) |
485 | const hasBoth = finderFactory('hls and web video video') | 485 | const hasBoth = finderFactory('hls and web video') |
486 | 486 | ||
487 | await waitJobs(servers) | 487 | await waitJobs(servers) |
488 | 488 | ||