On my site I have vue-video-player which use video.js library. On mobile chrome at samsung galaxy s9 it autoplay correctly but it doesn't autoplay on mobile safari at iphone 7.
HTML is:
<video-player class="video-player-box"
id="player"
ref="videoPlayer"
:options="playerOptions"
@ended="onPlayerEnded($event)">
</video-player>
and in my script tag:
data() {
return {
playerOptions: {
muted: true,
autoplay: true,
controls: false,
sources: [{
type: "video/mp4",
src: "https://res.cloudinary.com/dlqvkenro/video/upload/v1544320787/gvnn.mp4"
}],
poster: "/static/images/author.jpg",
}
}
},
Actually on safari when I click sound icon video start playing but I want it to start automatically when user enter page.
I added code to programically start player:
mounted() {
this.player.play()
.then(() => {
console.log('play succseed');
})
.catch(() => {
alert('safari prevent player');
});
},
and actually in safari alert appears. Is there anyting I can do to win against apple?