网课平台的鼠标失去焦点视频暂停是用户最大的天敌,在这提供对应三种播放模式的失去焦点暂停的解决方案。

Flash

对于 Flash 播放视频的网课平台,可以在浏览器中重写失去焦点函数。 F12 打开开发者工具,切换到 Console 面板,输入下面代码并回车。

1
2
3
4
5
6
7
8
9
if (!- [1, ] && !window.XMLHttpRequest || navigator.userAgent.indexOf("MSIE 8.0") > 0) {
    document.onfocusout = function() {
        return true;
    }
} else {
    window.onblur = function() {
        return true;
    }
}

H5

对于 H5 元素的网课平台,可以写个定时器,每秒钟设置一下播放状态。 F12 打开开发者工具,切换到 Console 面板,输入下面代码并回车。

1
2
3
4
setInterval(function () {
    var current_video = document.getElementsByTagName('video')[0]
    current_video.play()
}, 1000)

jQuery

对于引用 jQuery 函数的网课平台,可以在浏览器地址栏输入下面代码并回车。

1
javascript:jQuery.fn.pauseMovie=function(){}