diff options
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/assets/player/peertube-player-manager.ts | 14 | ||||
-rw-r--r-- | client/src/assets/player/peertube-plugin.ts | 2 | ||||
-rw-r--r-- | client/src/assets/player/webtorrent/webtorrent-plugin.ts | 2 |
3 files changed, 11 insertions, 7 deletions
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts index 61da6a4cb..5ebc247f2 100644 --- a/client/src/assets/player/peertube-player-manager.ts +++ b/client/src/assets/player/peertube-player-manager.ts | |||
@@ -187,7 +187,7 @@ export class PeertubePlayerManager { | |||
187 | ): videojs.PlayerOptions { | 187 | ): videojs.PlayerOptions { |
188 | const commonOptions = options.common | 188 | const commonOptions = options.common |
189 | 189 | ||
190 | let autoplay = commonOptions.autoplay | 190 | let autoplay = this.getAutoPlayValue(commonOptions.autoplay) |
191 | let html5 = {} | 191 | let html5 = {} |
192 | 192 | ||
193 | const plugins: VideoJSPluginOptions = { | 193 | const plugins: VideoJSPluginOptions = { |
@@ -232,9 +232,7 @@ export class PeertubePlayerManager { | |||
232 | ? commonOptions.muted | 232 | ? commonOptions.muted |
233 | : undefined, // Undefined so the player knows it has to check the local storage | 233 | : undefined, // Undefined so the player knows it has to check the local storage |
234 | 234 | ||
235 | autoplay: autoplay === true | 235 | autoplay: this.getAutoPlayValue(autoplay), |
236 | ? this.getAutoPlayValue() | ||
237 | : autoplay, | ||
238 | 236 | ||
239 | poster: commonOptions.poster, | 237 | poster: commonOptions.poster, |
240 | inactivityTimeout: commonOptions.inactivityTimeout, | 238 | inactivityTimeout: commonOptions.inactivityTimeout, |
@@ -510,9 +508,15 @@ export class PeertubePlayerManager { | |||
510 | }) | 508 | }) |
511 | } | 509 | } |
512 | 510 | ||
513 | private static getAutoPlayValue () { | 511 | private static getAutoPlayValue (autoplay: any) { |
512 | if (autoplay !== true) return autoplay | ||
513 | |||
514 | const isIOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform) | ||
514 | const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) | 515 | const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) |
515 | 516 | ||
517 | // Giving up with iOS | ||
518 | if (isIOS) return false | ||
519 | |||
516 | // We have issues with autoplay and Safari. | 520 | // We have issues with autoplay and Safari. |
517 | // any that tries to play using auto mute seems to work | 521 | // any that tries to play using auto mute seems to work |
518 | if (isSafari) return 'any' | 522 | if (isSafari) return 'any' |
diff --git a/client/src/assets/player/peertube-plugin.ts b/client/src/assets/player/peertube-plugin.ts index 5085f7f86..a5a706420 100644 --- a/client/src/assets/player/peertube-plugin.ts +++ b/client/src/assets/player/peertube-plugin.ts | |||
@@ -45,7 +45,7 @@ class PeerTubePlugin extends Plugin { | |||
45 | 45 | ||
46 | this.savedInactivityTimeout = player.options_.inactivityTimeout | 46 | this.savedInactivityTimeout = player.options_.inactivityTimeout |
47 | 47 | ||
48 | if (options.autoplay === true) this.player.addClass('vjs-has-autoplay') | 48 | if (options.autoplay) this.player.addClass('vjs-has-autoplay') |
49 | 49 | ||
50 | this.player.on('autoplay-failure', () => { | 50 | this.player.on('autoplay-failure', () => { |
51 | this.player.removeClass('vjs-has-autoplay') | 51 | this.player.removeClass('vjs-has-autoplay') |
diff --git a/client/src/assets/player/webtorrent/webtorrent-plugin.ts b/client/src/assets/player/webtorrent/webtorrent-plugin.ts index cb3deacc6..a894a90f5 100644 --- a/client/src/assets/player/webtorrent/webtorrent-plugin.ts +++ b/client/src/assets/player/webtorrent/webtorrent-plugin.ts | |||
@@ -417,7 +417,7 @@ class WebTorrentPlugin extends Plugin { | |||
417 | private initializePlayer () { | 417 | private initializePlayer () { |
418 | this.buildQualities() | 418 | this.buildQualities() |
419 | 419 | ||
420 | if (this.autoplay === true) { | 420 | if (this.autoplay) { |
421 | this.player.posterImage.hide() | 421 | this.player.posterImage.hide() |
422 | 422 | ||
423 | return this.updateVideoFile(undefined, { forcePlay: true, seek: this.startTime }) | 423 | return this.updateVideoFile(undefined, { forcePlay: true, seek: this.startTime }) |