相关疑难解决方法(0)

在Internet Explorer中禁用长时间运行脚本消息

我有一个JavaScript函数,其中包含一个迭代很多次的for循环.
调用此函数后,IE浏览器显示以下消息:

停止运行此脚本?
此页面上的脚本导致Web浏览器运行缓慢.如果它继续运行,您的计算机可能会无响应.

我怎样才能解决这个问题?
无论如何我可以从IE禁用此消息?

javascript internet-explorer

49
推荐指数
2
解决办法
11万
查看次数

为什么html5-video事件timeupdate会在chrome浏览器上触发两次?

html5-video事件timeupdate在chrome浏览器上触发两次.

重现步骤:

  1. 运行代码

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

  1. 点击按钮
  2. 检查结果(buttonClick x 1,timeUpdate x 2)

有任何想法吗 ?))

javascript video google-chrome javascript-events html5-video

6
推荐指数
1
解决办法
1553
查看次数

在视频HTML5中获取帧更改

我需要检测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)

javascript html5 html5-video

4
推荐指数
1
解决办法
9829
查看次数

在特定时间到达视频播放器时滚动

我正在开发一个页面,我必须用相关的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)

javascript pdf jquery scroll html5-video

1
推荐指数
1
解决办法
2150
查看次数