diff --git a/mods.json b/mods.json index a96840e..2903844 100644 --- a/mods.json +++ b/mods.json @@ -6,6 +6,5 @@ "Screenshot.js", "InputEater.js", "Transcript.js", - "PatchForceHLSJS.js", - "PatchFixSyncPlay.js" + "PatchForceHLSJS.js" ] \ No newline at end of file diff --git a/mods/PatchFixSyncPlay.js b/mods/PatchFixSyncPlay.js deleted file mode 100644 index b83d4a0..0000000 --- a/mods/PatchFixSyncPlay.js +++ /dev/null @@ -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; - }; - } -})()); diff --git a/mods_jade.json b/mods_jade.json index ea377a1..386901f 100644 --- a/mods_jade.json +++ b/mods_jade.json @@ -7,7 +7,6 @@ "InputEater.js", "Transcript.js", "PatchForceHLSJS.js", - "PatchFixSyncPlay.js", "jade/Shortcuts.js" ] \ No newline at end of file