Allow manually forcing HLS.js on
This commit is contained in:
parent
e383aa4738
commit
0cce72b24b
@ -6,7 +6,7 @@ import Jadefin from "../../Jadefin.js";
|
||||
import JadefinMod from "../../JadefinMod.js";
|
||||
import JadefinModules from "../../JadefinModules.js";
|
||||
|
||||
// https://github.com/jellyfin/jellyfin-android/issues/1031
|
||||
// Mainly spawned from https://github.com/jellyfin/jellyfin-android/issues/1031
|
||||
export default JadefinIntegrity("PatchAndroidHLSJS", import.meta.url, () => new (class PatchAndroidHLSJS extends JadefinMod {
|
||||
constructor() {
|
||||
super();
|
||||
@ -14,6 +14,14 @@ export default JadefinIntegrity("PatchAndroidHLSJS", import.meta.url, () => new
|
||||
this.enableHlsJsPlayer = this.enableHlsJsPlayer.bind(this);
|
||||
}
|
||||
|
||||
get isEnabled() {
|
||||
return this.storage.get("isEnabled", false);
|
||||
}
|
||||
|
||||
set isEnabled(value) {
|
||||
this.storage.set("isEnabled", value);
|
||||
}
|
||||
|
||||
async init(name, url) {
|
||||
await super.init(name, url);
|
||||
|
||||
@ -21,9 +29,36 @@ export default JadefinIntegrity("PatchAndroidHLSJS", import.meta.url, () => new
|
||||
this._enableHlsJsPlayer = htmlMediaHelper.rR.bind(htmlMediaHelper);
|
||||
|
||||
Object.defineProperty(htmlMediaHelper, "rR", { get: () => this.enableHlsJsPlayer });
|
||||
|
||||
const ExtrasMenu = /** @type {import("../ExtrasMenu.js").default} */ (Jadefin.getMod("ExtrasMenu"));
|
||||
|
||||
ExtrasMenu.items.push({
|
||||
name: "Enable HLS.js",
|
||||
secondaryText: "Sometimes helps with playback in some browsers",
|
||||
icon: "auto_fix_normal",
|
||||
in: ExtrasMenu.IN_CUSTOM,
|
||||
inCustom: (current, item) => {
|
||||
if (!this.isEnabled) {
|
||||
item.name = "Enable HLS.js";
|
||||
item.icon = "auto_fix_normal";
|
||||
} else {
|
||||
item.name = "Disable HLS.js";
|
||||
item.icon = "auto_fix_off";
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
cb: () => {
|
||||
this.isEnabled = !this.isEnabled;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
enableHlsJsPlayer(runTimeTicks, mediaType) {
|
||||
if (this.isEnabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// https://github.com/jellyfin/jellyfin-web/commit/baf1b55a0cb83d4cb63a18968fc93493ce785498
|
||||
if (JadefinModules.browser.android && mediaType === "Video") {
|
||||
mediaType = "Audio";
|
@ -8,5 +8,5 @@
|
||||
"Transcript.js",
|
||||
|
||||
"jade/Shortcuts.js",
|
||||
"jade/PatchAndroidHLSJS.js"
|
||||
"jade/PatchForceHLSJS.js"
|
||||
]
|
Loading…
Reference in New Issue
Block a user