h5
如果視訊是video元素,可以寫個定時器,每秒鐘設定一下播放狀态
f12打開開發者工具,切換到console面闆,輸入下面代碼并回車
setInterval(function () {
var current_video = document.getElementsByTagName('video')[0]
current_video.play()
}, 1000)
flash
如果是flash視訊,可以重寫失去焦點函數。
f12打開開發者工具,切換到console面闆,輸入下面代碼并回車
if (!-[1,] && !window.XMLHttpRequest || navigator.userAgent.indexOf("MSIE 8.0") > 0) {
document.onfocusout = function () {
return true;
}
} else {
window.onblur = function () {
return true;
}
}
jQuery
這種方法沒有驗證,适合引用jQuery的網課平台。
方法:在浏覽器位址欄輸入
javascript:jQuery.fn.pauseMovie=function(){}
ps:來源網絡學習....