diff options
author | Chocobozzz <me@florianbigard.com> | 2022-10-31 13:47:55 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-10-31 13:47:55 +0100 |
commit | eaa5dc3161569012188f5ce87099f00e6d0462d5 (patch) | |
tree | d21fd5b477ed1a457d3daa8c6f7f7eb6a102fbcd /client | |
parent | 6740b6428be1c27e9ad728eede7c428d1e2e9f47 (diff) | |
download | PeerTube-eaa5dc3161569012188f5ce87099f00e6d0462d5.tar.gz PeerTube-eaa5dc3161569012188f5ce87099f00e6d0462d5.tar.zst PeerTube-eaa5dc3161569012188f5ce87099f00e6d0462d5.zip |
Reapply playsinline on player fallback
Diffstat (limited to 'client')
-rw-r--r-- | client/e2e/src/suites-all/videos.e2e-spec.ts | 2 | ||||
-rw-r--r-- | client/src/assets/player/peertube-player-manager.ts | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/client/e2e/src/suites-all/videos.e2e-spec.ts b/client/e2e/src/suites-all/videos.e2e-spec.ts index 997d58884..d1ab9aef3 100644 --- a/client/e2e/src/suites-all/videos.e2e-spec.ts +++ b/client/e2e/src/suites-all/videos.e2e-spec.ts | |||
@@ -173,7 +173,7 @@ describe('Videos all workflow', () => { | |||
173 | 173 | ||
174 | await myAccountPage.playPlaylist() | 174 | await myAccountPage.playPlaylist() |
175 | 175 | ||
176 | await videoWatchPage.waitUntilVideoName(video2Name, 30 * 1000) | 176 | await videoWatchPage.waitUntilVideoName(video2Name, 40 * 1000) |
177 | }) | 177 | }) |
178 | 178 | ||
179 | it('Should watch the webtorrent playlist in the embed', async () => { | 179 | it('Should watch the webtorrent playlist in the embed', async () => { |
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 | ||
44 | export class PeertubePlayerManager { | 44 | export 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 |