invidious
invidious copied to clipboard
Add option for HLS quality in user preferences
Closes #3318 Closes #2236
If applicable, I'll like to claim the bounty for the latter issue.
This PR adds a new HLS
quality option that forces the usage of the HLS manifest given by the IOS InnerTube client. This allows qualities of up to 1080p on IOS devices but it also introduces a couple problems:
- You cannot change the video quality
- Usage of the new "HLS" quality option will completely negate the various workarounds to fetch encrypted and/or age-restricted streaming URLs
- When trying to force HLS, we ignore the cache and make a new request as HLS manifests aren't typically included in YouTube's normal responses
You'll also need to modify
disable_proxy
to accept anhls
option
That should do the trick. On another note, now that there's a hls
option, should the livestream
parameter be merged together with it?
Livestreams have both DASH and HLS manifests, video.js's can't handle YouTube's live stream DASH (YouTube uses self-initialising segments, which are part of the DASH spec, but heavily discouraged by the DASH interoperability guidelines, as it's a lot less efficient, sending the init data along with every segment, than doing it once), which is why Invidious only uses HLS, but external services that use Invidious's proxy, might use the live stream DASH manifests (FreeTube soon-ish).
Irrc Invidious treats the livestream parameter as a hls parameter and is used only to disable hls manifests.
Irrc Invidious treats the livestream parameter as a hls parameter and is used only to disable hls manifests.
We consider a /videoplayback
URL as a "livestream" if it contains &file=seg.ts
.
I don't know if that's the case for other HLS URLs tho.
I believe it is the case for the other HLS urls. I'll keep the livestream
parameter for now though since it may be too much of a breaking-change to remove that configuration option.
@syeopite is this PR intended to only work on iOS devices? When setting quality to HLS I'm only able to play back videos on an iPhone. Safari and all other browses on macOS just try to load indefinitely.
That's weird... Maybe it's related to #4199? It definitely shouldn't be limited to just IOS.
It could be something to do with the HLS streams returned by the iOS client, using MP4 files that contain vp9 video, which is possibly something that video.js doesn't support (For DASH and HLS, the player javascript has to extract the "raw" audio and video from the streams, so it's transmuxer needs to have support for the containers and codecs you want to use)?
On iOS, HLS manifests are handled by the browser itself, so that's probably why it works fine there.