I'm using mediaelement.js to display a video. I'm using this code:
<body>
<video id="player1" style="width: 100%; height: 100%;" preload="auto" autoplay="true" src="video.mp4"/>
<script>
$('video').mediaelementplayer({
features: ['playpause', 'progress', 'current', 'duration', 'tracks', 'volume', 'fullscreen'],
});
var player = new MediaElementPlayer('player1');
player.play();
</script>
</body>
When the page loads, I'd like to automatically start the video. This works fine in desktop browsers, however, in mobile browsers the video doesn't automatically play.
What am I doing wrong?