我已经设置了一个HTML5播放器(使用video.js),它在视频本身之前播放和广告视频。
问题出现在iPhone设备上,当Safari调用原生iOS播放器播放视频时,会使用允许用户轻松跳过广告的搜索控件。

我已经将属性"playisinline“和"webkit-playisinline”应用到了标签中,这只在iOS 10上有效(顺便说一下,你可以在下一次更新时本机应用它),但在iOS 9上,它仍然显示原生播放器正在寻找可能性。
我试着按照这里的建议在其他地方使用this,但是它有很多but,并且在我的播放器实现中给出了冲突。
我只需要控制全屏原生播放器,并通过重置当前播放时间来避免搜索,但我找不到如何做到这一点。
感谢您的帮助。
发布于 2016-10-19 10:45:32
你有没有试过下面的代码片段?它将阻止寻求前进。
这个想法非常简单,使用一个间隔来每秒获取当前位置。如果查找位置大于当前位置,则将其设置回去。这只是一种解决方法:)
if (document.getElementById("vid1")) {
videojs("vid1").ready(function() {
var myPlayer = this;
//Set initial time to 0
var currentTime = 0;
//This example allows users to seek backwards but not forwards.
//To disable all seeking replace the if statements from the next
//two functions with myPlayer.currentTime(currentTime);
myPlayer.on("seeking", function(event) {
if (currentTime < myPlayer.currentTime()) {
myPlayer.currentTime(currentTime);
}
});
myPlayer.on("seeked", function(event) {
if (currentTime < myPlayer.currentTime()) {
myPlayer.currentTime(currentTime);
}
});
setInterval(function() {
if (!myPlayer.paused()) {
currentTime = myPlayer.currentTime();
}
}, 1000);
});
}<link href="http://vjs.zencdn.net/4.12/video-js.css" rel="stylesheet"/>
<script src="http://vjs.zencdn.net/4.12/video.js"></script>
<video id="vid1" src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" controls class="video-js vjs-default-skin vjs-big-play-centered" width="640" height="360" preload="auto"></video>
https://stackoverflow.com/questions/40108957
复制相似问题