aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
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/src
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/src')
-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
5 files changed, 17 insertions, 8 deletions
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 }