0
我發現這個similar question here,但是答案在我的情況下不起作用。如何監聽HTML5視頻停止在jQuery中播放?
我的jsfiddle:http://jsfiddle.net/leongaban/yvne6fnt/
HTML
<div style="position: fixed; top: 0; width: 100%; height: 100%; z-index: -1;">
<video id="hero_video" controls="" autoplay="autoplay" preload poster="http://media.w3.org/2010/05/sintel/poster.png" style="width:100%; height:100%">
<source id="mp4" src="http://leongaban.com/v6/videos/clouds.mp4" type="video/mp4">
<source id="webm" src="http://leongaban.com/v6/videos/clouds.webm" type="video/webm">
<source id="ogv" src="http://leongaban.com/v6/videos/clouds.ogv" type="video/ogg">
<p>Your user agent does not support the HTML5 Video element.</p>
</video>
JS
$("#hero_video").bind('stop', function(e) {
console.log('stopped');
alert('stopped');
}, true);
/*
$("video").bind('stop', function(e) {
console.log('stopped');
alert('stopped');
}, true);
*/
啊甜美的感謝! – 2014-08-29 14:42:19
哦,我注意到,我不得不使用'stop pause'來代替只是因爲某種原因找到事件'stop' – 2014-08-29 14:55:11
是的,停止只在視頻結束時觸發。 – 2014-08-29 14:56:26