Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for HLS quality in user preferences #4118

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

syeopite
Copy link
Member

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:

  1. You cannot change the video quality
  2. Usage of the new "HLS" quality option will completely negate the various workarounds to fetch encrypted and/or age-restricted streaming URLs
  3. 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

Copy link
Member

@SamantazFox SamantazFox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll also need to modify disable_proxy to accept an hls option, and the proxy logic to respect that (honestly, good luck with that, that code is a mess :c)

src/invidious/routes/api/manifest.cr Outdated Show resolved Hide resolved
@syeopite
Copy link
Member Author

You'll also need to modify disable_proxy to accept an hls 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?

@absidue
Copy link
Contributor

absidue commented Sep 28, 2023

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).

@syeopite
Copy link
Member Author

Irrc Invidious treats the livestream parameter as a hls parameter and is used only to disable hls manifests.

@SamantazFox
Copy link
Member

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.

@syeopite
Copy link
Member Author

syeopite commented Oct 21, 2023

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.

src/invidious/videos/video_preferences.cr Outdated Show resolved Hide resolved
src/invidious/views/components/player.ecr Outdated Show resolved Hide resolved
src/invidious/routes/watch.cr Outdated Show resolved Hide resolved
Comment on lines 491 to 506
"video_quality_livestream_label": "Livestreams",
"video_quality_hls_label": "HLS",
"video_quality_dash_label": "DASH",
"video_quality_hd720_label": "hd720",
"video_quality_medium_label": "medium",
"video_quality_small_label": "small"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default VideoJS makes everything lowercase. So despite the fact that some of these are capitalized it'd just show up as "livestream" or "hls" on the quality selector.

@stonerl
Copy link

stonerl commented Nov 20, 2023

@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.

@syeopite
Copy link
Member Author

That's weird... Maybe it's related to #4199? It definitely shouldn't be limited to just IOS.

@absidue
Copy link
Contributor

absidue commented Nov 21, 2023

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.

Copy link

This pull request has been automatically marked as stale and will be closed in 30 days because it has not had recent activity and is much likely abandoned or outdated. If you think this pull request is still relevant and applicable, you just have to post a comment and it will be unmarked.

@github-actions github-actions bot added the stale label May 19, 2024
@syeopite
Copy link
Member Author

It seems like #4439 fixes the issues with enabling the quality selector on HLS videos! Livestreams are still not supported however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Adding the new hlsManifest [Bug] DASH quality on safari iOS
4 participants