diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-19 16:27:44 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-08-19 16:27:44 +0200 |
commit | ebc8dd52caaacb379f4cf060c9a8cca4081abd5c (patch) | |
tree | fe37ed794ef5396de752d30d0db2110a5da0d670 /client/src | |
parent | 9eccae74c844f09e9e3483db623fea00e0562365 (diff) | |
download | PeerTube-ebc8dd52caaacb379f4cf060c9a8cca4081abd5c.tar.gz PeerTube-ebc8dd52caaacb379f4cf060c9a8cca4081abd5c.tar.zst PeerTube-ebc8dd52caaacb379f4cf060c9a8cca4081abd5c.zip |
Correctly fix autoplay with webtorrent
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/assets/player/peertube-player-manager.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts index 8e0a9109f..4d72523f7 100644 --- a/client/src/assets/player/peertube-player-manager.ts +++ b/client/src/assets/player/peertube-player-manager.ts | |||
@@ -365,8 +365,12 @@ export class PeertubePlayerManager { | |||
365 | const commonOptions = options.common | 365 | const commonOptions = options.common |
366 | const webtorrentOptions = options.webtorrent | 366 | const webtorrentOptions = options.webtorrent |
367 | 367 | ||
368 | const autoplay = this.getAutoPlayValue(commonOptions.autoplay) === 'play' | ||
369 | ? true | ||
370 | : false | ||
371 | |||
368 | const webtorrent = { | 372 | const webtorrent = { |
369 | autoplay: commonOptions.autoplay, | 373 | autoplay, |
370 | videoDuration: commonOptions.videoDuration, | 374 | videoDuration: commonOptions.videoDuration, |
371 | playerElement: commonOptions.playerElement, | 375 | playerElement: commonOptions.playerElement, |
372 | videoFiles: webtorrentOptions.videoFiles, | 376 | videoFiles: webtorrentOptions.videoFiles, |
@@ -586,13 +590,9 @@ export class PeertubePlayerManager { | |||
586 | private static getAutoPlayValue (autoplay: any) { | 590 | private static getAutoPlayValue (autoplay: any) { |
587 | if (autoplay !== true) return autoplay | 591 | if (autoplay !== true) return autoplay |
588 | 592 | ||
589 | // We have issues with autoplay and Safari with webtorrent | 593 | // On first play, disable autoplay to avoid issues |
590 | if (isIOS()) { | 594 | // But if the player already played videos, we can safely autoplay next ones |
591 | // On first play, disable autoplay to avoid issues | 595 | if (isIOS() || isSafari()) { |
592 | // But if the player already played videos, we can safely autoplay next ones | ||
593 | return PeertubePlayerManager.alreadyPlayed ? 'play' : false | ||
594 | } else if (isSafari()) { | ||
595 | // Issues with Safari and webtorrent on first play | ||
596 | return PeertubePlayerManager.alreadyPlayed ? 'play' : false | 596 | return PeertubePlayerManager.alreadyPlayed ? 'play' : false |
597 | } | 597 | } |
598 | 598 | ||