mirror of https://github.com/Chocobozzz/PeerTube
Reapply playsinline on player fallback
parent
6740b6428b
commit
eaa5dc3161
|
@ -173,7 +173,7 @@ describe('Videos all workflow', () => {
|
||||||
|
|
||||||
await myAccountPage.playPlaylist()
|
await myAccountPage.playPlaylist()
|
||||||
|
|
||||||
await videoWatchPage.waitUntilVideoName(video2Name, 30 * 1000)
|
await videoWatchPage.waitUntilVideoName(video2Name, 40 * 1000)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should watch the webtorrent playlist in the embed', async () => {
|
it('Should watch the webtorrent playlist in the embed', async () => {
|
||||||
|
|
|
@ -43,6 +43,8 @@ CaptionsButton.prototype.label_ = ' '
|
||||||
|
|
||||||
export class PeertubePlayerManager {
|
export class PeertubePlayerManager {
|
||||||
private static playerElementClassName: string
|
private static playerElementClassName: string
|
||||||
|
private static playerElementAttributes: { name: string, value: string }[] = []
|
||||||
|
|
||||||
private static onPlayerChange: (player: videojs.Player) => void
|
private static onPlayerChange: (player: videojs.Player) => void
|
||||||
private static alreadyPlayed = false
|
private static alreadyPlayed = false
|
||||||
private static pluginsManager: PluginsManager
|
private static pluginsManager: PluginsManager
|
||||||
|
@ -59,8 +61,13 @@ export class PeertubePlayerManager {
|
||||||
this.pluginsManager = options.pluginsManager
|
this.pluginsManager = options.pluginsManager
|
||||||
|
|
||||||
this.onPlayerChange = onPlayerChange
|
this.onPlayerChange = onPlayerChange
|
||||||
|
|
||||||
this.playerElementClassName = options.common.playerElement.className
|
this.playerElementClassName = options.common.playerElement.className
|
||||||
|
|
||||||
|
for (const name of options.common.playerElement.getAttributeNames()) {
|
||||||
|
this.playerElementAttributes.push({ name, value: options.common.playerElement.getAttribute(name) })
|
||||||
|
}
|
||||||
|
|
||||||
if (mode === 'webtorrent') await import('./shared/webtorrent/webtorrent-plugin')
|
if (mode === 'webtorrent') await import('./shared/webtorrent/webtorrent-plugin')
|
||||||
if (mode === 'p2p-media-loader') {
|
if (mode === 'p2p-media-loader') {
|
||||||
const [ p2pMediaLoaderModule ] = await Promise.all([
|
const [ p2pMediaLoaderModule ] = await Promise.all([
|
||||||
|
@ -216,8 +223,15 @@ export class PeertubePlayerManager {
|
||||||
|
|
||||||
private static rebuildAndUpdateVideoElement (player: videojs.Player, commonOptions: CommonOptions) {
|
private static rebuildAndUpdateVideoElement (player: videojs.Player, commonOptions: CommonOptions) {
|
||||||
const newVideoElement = document.createElement('video')
|
const newVideoElement = document.createElement('video')
|
||||||
|
|
||||||
|
// Reset class
|
||||||
newVideoElement.className = this.playerElementClassName
|
newVideoElement.className = this.playerElementClassName
|
||||||
|
|
||||||
|
// Reapply attributes
|
||||||
|
for (const { name, value } of this.playerElementAttributes) {
|
||||||
|
newVideoElement.setAttribute(name, value)
|
||||||
|
}
|
||||||
|
|
||||||
// VideoJS wraps our video element inside a div
|
// VideoJS wraps our video element inside a div
|
||||||
let currentParentPlayerElement = commonOptions.playerElement.parentNode
|
let currentParentPlayerElement = commonOptions.playerElement.parentNode
|
||||||
// Fix on IOS, don't ask me why
|
// Fix on IOS, don't ask me why
|
||||||
|
|
Loading…
Reference in New Issue