DOM Exception 11 InvalidStateError with webkitEnterFullscree
DOM Exception 11 InvalidStateError with webkitEnterFullscreen()
我使用Chrome浏览器,我的HTML是
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
window.onload = function() {
var vid = document.createElement('video');
vid.src = "small.mp4";
document.body.appendChild(vid);
vid.addEventListener("loadedmetadata", function() {
vid.webkitEnterFullscreen();
});
};
</script>
</head>
<body>
</body>
</html>
我得到一个错误视频。webkitenterfullscreen ();
在'loadedmetadata'事件中不允许进入全屏。你必须等待点击/按键事件。
window.onload = function() {
var vid = document.createElement('video');
vid.src = "small.mp4";
document.body.appendChild(vid);
vid.play();
vid.addEventListener("click", function() {
vid.webkitEnterFullscreen();
});
};
相关文章:
- Fighting with FRP
- issue with FB.Event.subscribe
- geolocation-marker.js conflict with markerclusterer.js
- Angular 2.0 with JavaScript or TypeScript?
- 为什么不推荐使用“with”?是否有更好或其他方法可以“下降”到对象的命名空间
- WebComponentsJS with IE10
- 指令的模板必须只有一个根元素:With restrict E&替换true
- timeago.js with datatable and PHP
- Ajax and Json with Rails
- errors with Javascript try catch
- how to split a string with ','
- Understanding Javascript scope with "var that = this&qu
- Architecture for CPU intensive tasks with NodeJS & Socke
- How to declare a Map containing certain properties with flow
- 设置'这'在React with Inverse Data Flow中
- Unit-testing multiple use cases with Karma & Mocha.js
- Modify Javascript with C#
- 谷歌地图API v3:Initial View is Fine,but Gray Box with No Map if
- Using jQuery with classes from ES6
- Laravel 4 render() PDF with Javascript