diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-19 16:14:25 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-08-19 16:17:39 +0200 |
commit | 9eccae74c844f09e9e3483db623fea00e0562365 (patch) | |
tree | 9dde7d5928f260a8947c87c1396c469e07a9560a /client/src/assets/player/webtorrent | |
parent | 65b19fa47997ad7530f6558104dda71e80014b17 (diff) | |
download | PeerTube-9eccae74c844f09e9e3483db623fea00e0562365.tar.gz PeerTube-9eccae74c844f09e9e3483db623fea00e0562365.tar.zst PeerTube-9eccae74c844f09e9e3483db623fea00e0562365.zip |
Try to fix autoplay with ios/safari
* Disable autoplay on first load because we have weird issues (player
starts to play and stop so we loose the big play button). We also don't
want to autoplay muted videos (bad UX IMHO and we don't have ads to
display)
* Enable autoplay when we already played a video (fixes the issue with
playlists)
Diffstat (limited to 'client/src/assets/player/webtorrent')
-rw-r--r-- | client/src/assets/player/webtorrent/webtorrent-plugin.ts | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/client/src/assets/player/webtorrent/webtorrent-plugin.ts b/client/src/assets/player/webtorrent/webtorrent-plugin.ts index 5c8aca1f8..782c91cbd 100644 --- a/client/src/assets/player/webtorrent/webtorrent-plugin.ts +++ b/client/src/assets/player/webtorrent/webtorrent-plugin.ts | |||
@@ -74,7 +74,7 @@ class WebTorrentPlugin extends Plugin { | |||
74 | this.startTime = timeToInt(options.startTime) | 74 | this.startTime = timeToInt(options.startTime) |
75 | 75 | ||
76 | // Disable auto play on iOS | 76 | // Disable auto play on iOS |
77 | this.autoplay = options.autoplay && isIOS() === false | 77 | this.autoplay = options.autoplay |
78 | this.playerRefusedP2P = !getStoredP2PEnabled() | 78 | this.playerRefusedP2P = !getStoredP2PEnabled() |
79 | 79 | ||
80 | this.videoFiles = options.videoFiles | 80 | this.videoFiles = options.videoFiles |
@@ -329,11 +329,6 @@ class WebTorrentPlugin extends Plugin { | |||
329 | private tryToPlay (done?: (err?: Error) => void) { | 329 | private tryToPlay (done?: (err?: Error) => void) { |
330 | if (!done) done = function () { /* empty */ } | 330 | if (!done) done = function () { /* empty */ } |
331 | 331 | ||
332 | // Try in mute mode because we have issues with Safari | ||
333 | if (isSafari() && this.player.muted() === false) { | ||
334 | this.player.muted(true) | ||
335 | } | ||
336 | |||
337 | const playPromise = this.player.play() | 332 | const playPromise = this.player.play() |
338 | if (playPromise !== undefined) { | 333 | if (playPromise !== undefined) { |
339 | return playPromise.then(() => done()) | 334 | return playPromise.then(() => done()) |