Remove syncplay fix backport (10.9.2 includes it)

This commit is contained in:
Jade Macho 2024-05-18 23:18:04 +02:00
parent 87e74fb866
commit f51d5a0573
Signed by: 0x0ade
GPG Key ID: E1960710FE4FBEEF
3 changed files with 1 additions and 81 deletions

View File

@ -6,6 +6,5 @@
"Screenshot.js", "Screenshot.js",
"InputEater.js", "InputEater.js",
"Transcript.js", "Transcript.js",
"PatchForceHLSJS.js", "PatchForceHLSJS.js"
"PatchFixSyncPlay.js"
] ]

View File

@ -1,78 +0,0 @@
//@ts-check
import JadefinIntegrity from '../JadefinIntegrity.js';
import Jadefin from "../Jadefin.js";
import JadefinMod from "../JadefinMod.js";
import JadefinModules from "../JadefinModules.js";
import JadefinUtils from "../JadefinUtils.js";
// Mainly spawned from https://github.com/jellyfin/jellyfin-web/issues/5485
export default JadefinIntegrity("PatchFixSyncPlay", import.meta.url, () => new (class PatchFixSyncPlay extends JadefinMod {
constructor() {
super();
this._scheduleMightSkip = 0;
this._scheduleSkip = 0;
}
async init(name, url) {
const self = this;
await super.init(name, url);
await JadefinUtils.waitUntil(() => JadefinModules.syncPlay);
const queueCore = JadefinModules.syncPlay.Manager.queueCore;
const startPlayback = this._startPlayback = queueCore.startPlayback.bind(queueCore);
queueCore.startPlayback = function(apiClient) {
// scheduleReadyRequestOnPlaybackStart must occur BEFORE playerWrapper.localPlay
if (this.manager.isFollowingGroupPlayback() && !this.isPlaylistEmpty()) {
this.scheduleReadyRequestOnPlaybackStart(apiClient, "startPlayback");
self._scheduleMightSkip++;
self.hookPlayerWrapper(this.manager.getPlayerWrapper());
}
return startPlayback(apiClient);
};
const scheduleReadyRequestOnPlaybackStart = this._scheduleReadyRequestOnPlaybackStart = queueCore.scheduleReadyRequestOnPlaybackStart.bind(queueCore);
queueCore.scheduleReadyRequestOnPlaybackStart = function(apiClient, origin) {
if (origin == "startPlayback" && self._scheduleSkip > 0) {
self._scheduleSkip--;
return;
}
return scheduleReadyRequestOnPlaybackStart(apiClient, origin);
};
}
/**
* @param {any} playerWrapper
*/
hookPlayerWrapper(playerWrapper) {
if (playerWrapper._PatchFixSyncPlay_localPlay) {
return;
}
const localPlay = playerWrapper._PatchFixSyncPlay_localPlay = playerWrapper.localPlay.bind(playerWrapper);
playerWrapper.localPlay = (options) => {
const skip = this._scheduleMightSkip > 0;
if (skip) {
this._scheduleMightSkip--;
this._scheduleSkip++;
}
const rv = localPlay(options);
rv.catch(() => {
if (skip) {
this._scheduleSkip--;
}
});
return rv;
};
}
})());

View File

@ -7,7 +7,6 @@
"InputEater.js", "InputEater.js",
"Transcript.js", "Transcript.js",
"PatchForceHLSJS.js", "PatchForceHLSJS.js",
"PatchFixSyncPlay.js",
"jade/Shortcuts.js" "jade/Shortcuts.js"
] ]