mirror of https://github.com/Chocobozzz/PeerTube
Fix autoplay on Safari
parent
ec401ba0e0
commit
6422847473
|
@ -233,7 +233,7 @@ export class PeertubePlayerManager {
|
|||
: undefined, // Undefined so the player knows it has to check the local storage
|
||||
|
||||
autoplay: autoplay === true
|
||||
? 'play' // Use 'any' instead of true to get notifier by videojs if autoplay fails
|
||||
? this.getAutoPlayValue()
|
||||
: autoplay,
|
||||
|
||||
poster: commonOptions.poster,
|
||||
|
@ -509,6 +509,16 @@ export class PeertubePlayerManager {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
private static getAutoPlayValue () {
|
||||
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)
|
||||
|
||||
// We have issues with autoplay and Safari.
|
||||
// any that tries to play using auto mute seems to work
|
||||
if (isSafari) return 'any'
|
||||
|
||||
return 'play'
|
||||
}
|
||||
}
|
||||
|
||||
// ############################################################################
|
||||
|
|
Loading…
Reference in New Issue