删除HTML5视频和控件适用于iPad [英] Removing HTML5 video 'Controls' for iPad

查看:37
本文介绍了删除HTML5视频和控件适用于iPad的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现HTML5视频属性中未包含控件".

I've discovered when NOT including 'Controls' within the HTML5 video attribute.

iPad无法播放视频.

The iPad will not play the video.

如何删除HTML5视频控件;同时仍允许视频正常运行;在iPad iOS上.

How do I remove the HTML5 video controls; while still allowing the video to function normally; on iPad iOS.

注意://我能以某种方式删除脚本中的控件"吗?同时在HTML5视频标记中保持完整;这可能是可行的解决方案吗?

Note: // Could I somehow remove 'Controls' with a script; while keeping it in tact within the HTML5 video mark-up; could this be a viable solution?

推荐答案

用户需要控件才能与视频进行交互,否则如何播放,暂停等?

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构建自己的集合(请参见

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);

这篇关于删除HTML5视频和控件适用于iPad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆