我有一个JavaScript函数,其中包含一个迭代很多次的for循环.
调用此函数后,IE浏览器显示以下消息:
停止运行此脚本?
此页面上的脚本导致Web浏览器运行缓慢.如果它继续运行,您的计算机可能会无响应.
我怎样才能解决这个问题?
无论如何我可以从IE禁用此消息?
html5-video事件timeupdate在chrome浏览器上触发两次.
重现步骤:
<!DOCTYPE html>
<html lang="en">
<head>
<script
src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha256-k2WSCIexGzOj3Euiig+TlR8gA0EmPjuc79OEeY5L45g="
crossorigin="anonymous"></script>
</head>
<body>
<video id="video">
<source src=http://techslides.com/demos/sample-videos/small.mp4 type=video/mp4>
</video>
<button id="button">Update time</button>
<script>
$( document ).ready(function() {
var vid = document.getElementById("video")
vid.addEventListener("timeupdate", timeUpdate, false);
$("#button").on("click", buttonClick);
function timeUpdate(e){
console.log("timeUpdate");
}
function buttonClick(e){
console.log("buttonClick");
vid.currentTime = 1;
}
});
</script>
</body>
</html>Run Code Online (Sandbox Code Playgroud)
有任何想法吗 ?))
javascript video google-chrome javascript-events html5-video
我需要检测HTML 5中视频的所有帧更改,我尝试了以下代码,但我无法获得所有更改,只有我每秒可以获得8或9次更新..
<body>
<canvas id="Canvas" width="800" height="450" style="position:absolute; left:5; top:5">Can't Load Canvas</canvas>
<video id="videoPlay" muted controls>
<source src="assets/soccer.webm" type="video/webm">
<source src="assets/soccer.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</body>
<script type="text/javascript">
videoPlay.addEventListener('timeupdate', function (){
putOverlay();
});
function putOverlay(){
console.log(videoPlay.currentTime);
console.log("another frame");
}
</script>
</html>
Run Code Online (Sandbox Code Playgroud)
我也尝试了以下代码,但是随着时间的推移,使用定时器会导致帧与定时器给出的值之间失去同步.
<body>
<canvas id="LeCanvas" width="800" height="450" style="position:absolute; left:5; top:5">Can't Load Canvas</canvas>
<!-- Video -->
<video id="videoPlay" controls>
<source src="assets/soccer.webm" type="video/webm">
<source src="assets/soccer.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</body> …Run Code Online (Sandbox Code Playgroud) 我正在开发一个页面,我必须用相关的pdf显示视频.我已经使用pdf.js和video.js项目分别阅读pdf和视频.它们都在不同的div中实现.这是我的网页截图的链接在这里.我需要实现哪些检查视频当前时间的函数,改变按照以下时间PDF格的位置是我实现的代码,但它不工作
//function to perform on every timeupdate
var myFunc =function(){
var myPlayer = this;
var whereYouAt = myPlayer.currentTime();
//working of function
switch(whereYouAt)
{
case 30: bookmarkscroll('pageContainer2');
break;
case 60: bookmarkscroll('pageContainer3');
break;
case 90: bookmarkscroll('pageContainer4');
break;
case 120: bookmarkscroll('pageContainer5');
break;
case 150: bookmarkscroll('pageContainer6');
break;
case 180: bookmarkscroll('pageContainer7');
break;
}
};
myPlayer.addEvent("timeupdate",myFunc);
Run Code Online (Sandbox Code Playgroud)