且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

删除iPad的HTML5视频“控件”

更新时间:2023-01-06 09:44:30

用户需要控件才能与视频互动,否则他们怎么玩它,暂停等等。

The user needs controls to be able to interact with the video, otherwise how can they play it, pause it etc.?

您可以使用JavaScript删除控件但效果相同,即用户无法控制视频。

You can remove the controls with JavaScript but it would have the same effect, i.e. the user unable to control the video.

因此,您需要将控件保留,或隐藏它们并使用Media API构建您自己的集合(请参阅使用HTML5多媒体组件 - 第3部分:自定义控件)。这样你就可以限制控件了。例如。

So you need to either leave the control in, or hide them and build your own set using the Media API (see Working with HTML5 multimedia components – Part 3: Custom controls ). This way you could limit the controls for example.

如果你只是想让用户在点击它时播放视频,你可以试试像:

If you want to simply allow the user to play the video when they "click" on it, you could try something like:

var video = document.getElementById('myVideoId');
video.addEventListener('click', function() { video.play(); }, false);