Closed nlhintz closed 1 month ago
Sorry for the formatting, GitHub reformatted my code block, and I couldn't attach the patch file directly. I've included the patch in the ".zip" file that's attached.
Okay, going live with this in v3.2.4
@m0ngr31 Thank you!
The EMBY implementation for IPTV currently only accesses the first stream in the playlist. The ESPN+ channels that have multiple streams seem to have the lowest bandwidth/resolution stream listed first in the playlist, so EMBY always plays the lowest bandwidth/resolution stream. Are there any downsides to sorting the playlist by bandwidth so the highest bandwidth stream is first in the playlist (maybe enable this behavior based on an environment variable)? I've been using the patch included below for a while, and it seems to work as expected.
Nathan
`diff --git a/services/playlist-handler.ts b/services/playlist-handler.ts index 902c184..1f1c547 100644 --- a/services/playlist-handler.ts +++ b/services/playlist-handler.ts @@ -129,10 +129,21 @@ export class PlaylistHandler { const urlParams = this.network === 'foxsports' ? new URL(realManifestUrl).search : '';
let updatedManifest = clonedManifest;
const playlist = HLS.parse(clonedManifest);
/* Sort playlist so highest resolution is first in list (EMBY workaround) /
playlist.variants.sort((v1,v2) => {
if (v1.bandwidth > v2.bandwidth) {
return -1;
}
if (v1.bandwidth < v2.bandwidth) {
return 1;
}
return 0;
});
let updatedManifest = HLS.stringify(playlist);
if (this.network !== 'foxsports') { const audioTracks = [...manifest.matchAll(reAudioTrack)]; audioTracks.forEach(track => { -- 2.46.1 `