mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 08:07:18 +02:00
Fix video not showing then the "Skip splash video" setting is off
This commit is contained in:
parent
da54bd5302
commit
f78bd31b58
@ -778,14 +778,17 @@ function watchHeader() {
|
|||||||
|
|
||||||
function patchVideoApi() {
|
function patchVideoApi() {
|
||||||
const PREF_SKIP_SPLASH_VIDEO = PREFS.get(Preferences.SKIP_SPLASH_VIDEO);
|
const PREF_SKIP_SPLASH_VIDEO = PREFS.get(Preferences.SKIP_SPLASH_VIDEO);
|
||||||
// Do nothing if the "Skip splash video" setting is off
|
|
||||||
if (!PREF_SKIP_SPLASH_VIDEO) {
|
// Show video player when it's ready
|
||||||
return;
|
var showFunc;
|
||||||
|
showFunc = function() {
|
||||||
|
this.style.visibility = 'visible';
|
||||||
|
this.removeEventListener('playing', showFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 (PREF_SKIP_SPLASH_VIDEO && this.className.startsWith('XboxSplashVideo')) {
|
||||||
this.volume = 0;
|
this.volume = 0;
|
||||||
this.style.display = 'none';
|
this.style.display = 'none';
|
||||||
this.dispatchEvent(new Event('ended'));
|
this.dispatchEvent(new Event('ended'));
|
||||||
@ -795,14 +798,8 @@ function patchVideoApi() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show video player when it's ready
|
|
||||||
let showFunc;
|
|
||||||
showFunc = function() {
|
|
||||||
this.style.visibility = 'visible';
|
|
||||||
this.removeEventListener('playing', showFunc);
|
|
||||||
}
|
|
||||||
this.addEventListener('playing', showFunc);
|
|
||||||
|
|
||||||
|
this.addEventListener('playing', showFunc);
|
||||||
return this.orgPlay.apply(this);
|
return this.orgPlay.apply(this);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user