aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-10-31 13:47:55 +0100
committerChocobozzz <me@florianbigard.com>2022-10-31 13:47:55 +0100
commiteaa5dc3161569012188f5ce87099f00e6d0462d5 (patch)
treed21fd5b477ed1a457d3daa8c6f7f7eb6a102fbcd /client/src
parent6740b6428be1c27e9ad728eede7c428d1e2e9f47 (diff)
downloadPeerTube-eaa5dc3161569012188f5ce87099f00e6d0462d5.tar.gz
PeerTube-eaa5dc3161569012188f5ce87099f00e6d0462d5.tar.zst
PeerTube-eaa5dc3161569012188f5ce87099f00e6d0462d5.zip
Reapply playsinline on player fallback
Diffstat (limited to 'client/src')
-rw-r--r--client/src/assets/player/peertube-player-manager.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts
index 9663d90a2..56310c4e9 100644
--- a/client/src/assets/player/peertube-player-manager.ts
+++ b/client/src/assets/player/peertube-player-manager.ts
@@ -43,6 +43,8 @@ CaptionsButton.prototype.label_ = ' '
43 43
44export class PeertubePlayerManager { 44export class PeertubePlayerManager {
45 private static playerElementClassName: string 45 private static playerElementClassName: string
46 private static playerElementAttributes: { name: string, value: string }[] = []
47
46 private static onPlayerChange: (player: videojs.Player) => void 48 private static onPlayerChange: (player: videojs.Player) => void
47 private static alreadyPlayed = false 49 private static alreadyPlayed = false
48 private static pluginsManager: PluginsManager 50 private static pluginsManager: PluginsManager
@@ -59,8 +61,13 @@ export class PeertubePlayerManager {
59 this.pluginsManager = options.pluginsManager 61 this.pluginsManager = options.pluginsManager
60 62
61 this.onPlayerChange = onPlayerChange 63 this.onPlayerChange = onPlayerChange
64
62 this.playerElementClassName = options.common.playerElement.className 65 this.playerElementClassName = options.common.playerElement.className
63 66
67 for (const name of options.common.playerElement.getAttributeNames()) {
68 this.playerElementAttributes.push({ name, value: options.common.playerElement.getAttribute(name) })
69 }
70
64 if (mode === 'webtorrent') await import('./shared/webtorrent/webtorrent-plugin') 71 if (mode === 'webtorrent') await import('./shared/webtorrent/webtorrent-plugin')
65 if (mode === 'p2p-media-loader') { 72 if (mode === 'p2p-media-loader') {
66 const [ p2pMediaLoaderModule ] = await Promise.all([ 73 const [ p2pMediaLoaderModule ] = await Promise.all([
@@ -216,8 +223,15 @@ export class PeertubePlayerManager {
216 223
217 private static rebuildAndUpdateVideoElement (player: videojs.Player, commonOptions: CommonOptions) { 224 private static rebuildAndUpdateVideoElement (player: videojs.Player, commonOptions: CommonOptions) {
218 const newVideoElement = document.createElement('video') 225 const newVideoElement = document.createElement('video')
226
227 // Reset class
219 newVideoElement.className = this.playerElementClassName 228 newVideoElement.className = this.playerElementClassName
220 229
230 // Reapply attributes
231 for (const { name, value } of this.playerElementAttributes) {
232 newVideoElement.setAttribute(name, value)
233 }
234
221 // VideoJS wraps our video element inside a div 235 // VideoJS wraps our video element inside a div
222 let currentParentPlayerElement = commonOptions.playerElement.parentNode 236 let currentParentPlayerElement = commonOptions.playerElement.parentNode
223 // Fix on IOS, don't ask me why 237 // Fix on IOS, don't ask me why