Fix autoplay on Safari

pull/2621/head
Chocobozzz 2020-05-11 17:20:23 +02:00
parent ec401ba0e0
commit 6422847473
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 11 additions and 1 deletions

View File

@ -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'
}
}
// ############################################################################