mirror of https://github.com/Chocobozzz/PeerTube
Correctly fix autoplay with webtorrent
parent
9eccae74c8
commit
ebc8dd52ca
|
@ -365,8 +365,12 @@ export class PeertubePlayerManager {
|
||||||
const commonOptions = options.common
|
const commonOptions = options.common
|
||||||
const webtorrentOptions = options.webtorrent
|
const webtorrentOptions = options.webtorrent
|
||||||
|
|
||||||
|
const autoplay = this.getAutoPlayValue(commonOptions.autoplay) === 'play'
|
||||||
|
? true
|
||||||
|
: false
|
||||||
|
|
||||||
const webtorrent = {
|
const webtorrent = {
|
||||||
autoplay: commonOptions.autoplay,
|
autoplay,
|
||||||
videoDuration: commonOptions.videoDuration,
|
videoDuration: commonOptions.videoDuration,
|
||||||
playerElement: commonOptions.playerElement,
|
playerElement: commonOptions.playerElement,
|
||||||
videoFiles: webtorrentOptions.videoFiles,
|
videoFiles: webtorrentOptions.videoFiles,
|
||||||
|
@ -586,13 +590,9 @@ export class PeertubePlayerManager {
|
||||||
private static getAutoPlayValue (autoplay: any) {
|
private static getAutoPlayValue (autoplay: any) {
|
||||||
if (autoplay !== true) return autoplay
|
if (autoplay !== true) return autoplay
|
||||||
|
|
||||||
// We have issues with autoplay and Safari with webtorrent
|
// On first play, disable autoplay to avoid issues
|
||||||
if (isIOS()) {
|
// But if the player already played videos, we can safely autoplay next ones
|
||||||
// On first play, disable autoplay to avoid issues
|
if (isIOS() || isSafari()) {
|
||||||
// But if the player already played videos, we can safely autoplay next ones
|
|
||||||
return PeertubePlayerManager.alreadyPlayed ? 'play' : false
|
|
||||||
} else if (isSafari()) {
|
|
||||||
// Issues with Safari and webtorrent on first play
|
|
||||||
return PeertubePlayerManager.alreadyPlayed ? 'play' : false
|
return PeertubePlayerManager.alreadyPlayed ? 'play' : false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue