mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 15:47: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;
|
||||
}
|
||||
|
||||
#game-stream video {
|
||||
visibility: hidden;
|
||||
}
|
||||
`;
|
||||
|
||||
// Reduce animations
|
||||
@ -782,17 +785,25 @@ function patchVideoApi() {
|
||||
|
||||
HTMLMediaElement.prototype.orgPlay = HTMLMediaElement.prototype.play;
|
||||
HTMLMediaElement.prototype.play = function() {
|
||||
if (!this.className.startsWith('XboxSplashVideo')) {
|
||||
return this.orgPlay.apply(this);
|
||||
if (this.className.startsWith('XboxSplashVideo')) {
|
||||
this.volume = 0;
|
||||
this.style.display = 'none';
|
||||
this.dispatchEvent(new Event('ended'));
|
||||
|
||||
return {
|
||||
catch: () => {},
|
||||
};
|
||||
}
|
||||
|
||||
this.volume = 0;
|
||||
this.style.display = 'none';
|
||||
this.dispatchEvent(new Event('ended'));
|
||||
// Show video player when it's ready
|
||||
let showFunc;
|
||||
showFunc = function() {
|
||||
this.style.visibility = 'visible';
|
||||
this.removeEventListener('playing', showFunc);
|
||||
}
|
||||
this.addEventListener('playing', showFunc);
|
||||
|
||||
return {
|
||||
catch: () => {},
|
||||
};
|
||||
return this.orgPlay.apply(this);
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user