我正在开发一个支持 video-js
广告的 html5 播放器
既然我知道它在 iOS 上不起作用,那么在 Android 上也一样吗?
到目前为止,我已经尝试过这些,但在 Android 中的自动播放上没有成功
HTML
<video id="inReadPlayer" autoplay loop="loop"
controls preload="auto" class="video-js vjs-default-skin" width="640"
height="360" > <source src="'+videoSource+'" type="video/mp4">
</video>
JS
var player = videojs('inReadPlayer', { /* Options */ }, function() {
this.play();
this.on('ended', function() {
});
});
提前致谢
最佳答案
试试这个:
var videoplayer = document.getElementById('inReadPlayer')
videoplayer.addEventListener("load", function() {
videoplayer.play();
});
videoplayer.onended = function() {
source.setAttribute('src', 'MAINVIDEO.mp4');
};
<video id="inReadPlayer" autoplay loop="loop"
controls preload="auto" class="video-js vjs-default-skin" width="640"
height="360" > <source src="'+videoSource+'" type="video/mp4">
</video>
Note that this snippet won't work because there is no video source
关于javascript - Android 中的 HTML5 视频自动播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39012804/