h5player
h5player copied to clipboard
[BUG]Uncaught TypeError: Illegal invocation
- 问题描述
一点击←键或者→键的时候,就开始不停报错Uncaught TypeError: Illegal invocation
2. 出现上述问题的地址
https://www.bilibili.com/video/BV13g411Y7GS/?p=10&vd_source=fd88d658a9d0ca1a2a1d289cafc700c1 3. 你使用的浏览器与浏览器版本信息
360极速浏览器X : 21.0.1200.0 (正式版本) (64 位) 内核:Chrome/95.0.4638.69 4. 其他附注信息
Edge 有一样的问题。疯狂报错。然后左右失效。
userscript.html?name=HTML5%25E8%25A7%2586%25E9%25A2%2591%25E6%2592%25AD%25E6%2594%25BE%25E5%2599%25A8%25E5%25A2%259E%25E5%25BC%25BA%25E8%2584%259A%25E6%259C%25AC.user.js&id=518d614c-9e34-4dd5-bf2d-2ed66afb5d84:407 Uncaught TypeError: Illegal invocation
at s.get (userscript.html?name=HTML5%25E8%25A7%2586%25E9%25A2%2591%25E6%2592%25AD%25E6%2594%25BE%25E5%2599%25A8%25E5%25A2%259E%25E5%25BC%25BA%25E8%2584%259A%25E6%259C%25AC.user.js&id=518d614c-9e34-4dd5-bf2d-2ed66afb5d84:407:53)
at s.get [as currentTime] (userscript.html?name=HTML5%25E8%25A7%2586%25E9%25A2%2591%25E6%2592%25AD%25E6%2594%25BE%25E5%2599%25A8%25E5%25A2%259E%25E5%25BC%25BA%25E8%2584%259A%25E6%259C%25AC.user.js&id=518d614c-9e34-4dd5-bf2d-2ed66afb5d84:6036:44)
at Object.getTime (core.js?v=2802018:63:2775)
at Object.k [as getTime] (core.js?v=2802018:43:2327)
at T (core.js?v=2802018:52:5512)
at S (core.js?v=2802018:52:5256)
get @ userscript.html?name=HTML5%25E8%25A7%2586%25E9%25A2%2591%25E6%2592%25AD%25E6%2594%25BE%25E5%2599%25A8%25E5%25A2%259E%25E5%25BC%25BA%25E8%2584%259A%25E6%259C%25AC.user.js&id=518d614c-9e34-4dd5-bf2d-2ed66afb5d84:407
get @ userscript.html?name=HTML5%25E8%25A7%2586%25E9%25A2%2591%25E6%2592%25AD%25E6%2594%25BE%25E5%2599%25A8%25E5%25A2%259E%25E5%25BC%25BA%25E8%2584%259A%25E6%259C%25AC.user.js&id=518d614c-9e34-4dd5-bf2d-2ed66afb5d84:6036
getTime @ core.js?v=2802018:63
k @ core.js?v=2802018:43
T @ core.js?v=2802018:52
S @ core.js?v=2802018:52
userscript.html?
/**
* 劫持 playbackRate、volume、currentTime 属性,并增加锁定的逻辑,从而实现更强的抗干扰能力
*/
function hijackPrototypeProperty (element, property) {
if (!element || !element.prototype || !originDescriptors[property]) {
return false
}
original.Object.defineProperty.call(Object, element.prototype, property, {
configurable: true,
enumerable: true,
get: function () {
const val = originDescriptors[property].get.apply(this, arguments);
// original.console.log(`[mediaElementPropertyHijack][${property}][get]`, val)
const mediaPlusApi = createMediaPlusApi(this);
if (mediaPlusApi && mediaPlusApi.isLock(property)) {
if (property === 'playbackRate') {
return +!+[]
}
}
return val
},