aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-05-11 17:20:23 +0200
committerChocobozzz <me@florianbigard.com>2020-05-11 17:48:56 +0200
commit6422847473a7dd1aa6066d2735a66a47a956f5e4 (patch)
tree04bc9153f197fd5407d60cb68b5c4d722f29278d /client/src
parentec401ba0e0b213bdbd57d84ea8c3c1430c1c4cb6 (diff)
downloadPeerTube-6422847473a7dd1aa6066d2735a66a47a956f5e4.tar.gz
PeerTube-6422847473a7dd1aa6066d2735a66a47a956f5e4.tar.zst
PeerTube-6422847473a7dd1aa6066d2735a66a47a956f5e4.zip
Fix autoplay on Safari
Diffstat (limited to 'client/src')
-rw-r--r--client/src/assets/player/peertube-player-manager.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts
index 12e460f03..61da6a4cb 100644
--- a/client/src/assets/player/peertube-player-manager.ts
+++ b/client/src/assets/player/peertube-player-manager.ts
@@ -233,7 +233,7 @@ export class PeertubePlayerManager {
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: autoplay === true
236 ? 'play' // Use 'any' instead of true to get notifier by videojs if autoplay fails 236 ? this.getAutoPlayValue()
237 : autoplay, 237 : autoplay,
238 238
239 poster: commonOptions.poster, 239 poster: commonOptions.poster,
@@ -509,6 +509,16 @@ export class PeertubePlayerManager {
509 } 509 }
510 }) 510 })
511 } 511 }
512
513 private static getAutoPlayValue () {
514 const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)
515
516 // We have issues with autoplay and Safari.
517 // any that tries to play using auto mute seems to work
518 if (isSafari) return 'any'
519
520 return 'play'
521 }
512} 522}
513 523
514// ############################################################################ 524// ############################################################################