mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 08:07:18 +02:00
Hide video player until it's ready
This commit is contained in:
parent
0e2066e461
commit
a9eb70eaae
@ -284,6 +284,9 @@ div[class*=NotFocusedDialog] {
|
|||||||
height: 0px !important;
|
height: 0px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#game-stream video {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// Reduce animations
|
// Reduce animations
|
||||||
@ -782,10 +785,7 @@ function patchVideoApi() {
|
|||||||
|
|
||||||
HTMLMediaElement.prototype.orgPlay = HTMLMediaElement.prototype.play;
|
HTMLMediaElement.prototype.orgPlay = HTMLMediaElement.prototype.play;
|
||||||
HTMLMediaElement.prototype.play = function() {
|
HTMLMediaElement.prototype.play = function() {
|
||||||
if (!this.className.startsWith('XboxSplashVideo')) {
|
if (this.className.startsWith('XboxSplashVideo')) {
|
||||||
return this.orgPlay.apply(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.volume = 0;
|
this.volume = 0;
|
||||||
this.style.display = 'none';
|
this.style.display = 'none';
|
||||||
this.dispatchEvent(new Event('ended'));
|
this.dispatchEvent(new Event('ended'));
|
||||||
@ -793,6 +793,17 @@ function patchVideoApi() {
|
|||||||
return {
|
return {
|
||||||
catch: () => {},
|
catch: () => {},
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show video player when it's ready
|
||||||
|
let showFunc;
|
||||||
|
showFunc = function() {
|
||||||
|
this.style.visibility = 'visible';
|
||||||
|
this.removeEventListener('playing', showFunc);
|
||||||
|
}
|
||||||
|
this.addEventListener('playing', showFunc);
|
||||||
|
|
||||||
|
return this.orgPlay.apply(this);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user