[英]How can I hide my custom html5 video controls when the user is inactive?
[英]How can I create custom HTML5 video controls?
我有兴趣在HTML5中构建自定义视频播放器。 使用Ogg和h.264的双重格式嵌入html5视频媒体没有问题。 我的主要问题是引用视频标记元素的API。 我可以通过javascript访问哪些属性和事件监听器?
对于基本UI,您只需要播放暂停和音量。
HTMLVideoElement = document.getElementById("myvideo");
HTMLVideoElement.play();
HTMLVideoElement.pause();
HTMLVideoElement.volume = 1; /* values 0 to 1 */
这些都很好
duration = HTMLVideoElement.duration;
currentTime = HTMLVideoElement.currentTime;
这将打印出完整列表,但要小心超出HTML5记录的API。
<video id="myvideo">
<source id="vidsource">
</video>
<script>
var HTMLVideoElement = document.getElementById("myvideo");
for (var key in HTMLVideoElement) {
document.write("<li>"+ key + ": " + HTMLVideoElement[key]);
}
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.