Skip to content

Commit 74d8f44

Browse files
authored
Fixes firefox issues
1 parent 3cb3821 commit 74d8f44

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/headless-hook.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22
const origPlay = HTMLMediaElement.prototype.play;
33
HTMLMediaElement.prototype.play = function(...args){
44
if(!this.isConnected){
5+
let parent = this.parentNode;
6+
let next = this.nextSibling;
57
try{ (document.body || document.documentElement).appendChild(this); }catch(e){}
8+
const res = origPlay.apply(this, args);
9+
try{
10+
if(parent){
11+
parent.insertBefore(this, next);
12+
}
13+
}catch(e){}
14+
return res;
615
}
716
return origPlay.apply(this, args);
817
};

0 commit comments

Comments
 (0)