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

[Bug] DASH quality on safari iOS #2236

Open
Jerroder opened this issue Jul 2, 2021 · 21 comments · May be fixed by #4118 or #4439
Open

[Bug] DASH quality on safari iOS #2236

Jerroder opened this issue Jul 2, 2021 · 21 comments · May be fixed by #4118 or #4439
Labels
bounty bounty:20$ bug Something isn't working

Comments

@Jerroder
Copy link

Jerroder commented Jul 2, 2021

Describe the bug

This has already been reported here and here and fixed in this PR but I still have the issue, it just loads at 144p and there's no gear icon to change the quality.

Steps to Reproduce

Play any video with dash quality enabled on and iOS device (not iPadOS though since it seems like dash in supported on there).

Additional context

According to this answer, dash isn't supported on iOS and must be replaced with fmp4 in HLS.

@Jerroder Jerroder added the bug Something isn't working label Jul 2, 2021
@Phantop
Copy link

Phantop commented Jul 22, 2021

Yeah. I saw that PR too and I can report Invidious working with DASH on my iPad but not on any iPhones. I can't imagine this being easy to fix if DASH is just outright unsupported on iOS but it would be a big improvement.

@TheFrenchGhosty
Copy link
Member

We discussed internally. The reason no one from the main team worked on this was that we had no way to test it easily (since we don't have any iOS device). This problem is now solved since we now have access to BrowserStack (a provider that gives access to real iOS devices).


The solution we discussed is to have HLS streams served to iOS devices (and keep using DASH for other devices), the reason being that HLS only support H.264 or H.265 (see https://www.cloudflare.com/learning/video/what-is-mpeg-dash/ ) while YouTube provides VP9/AV1 too.

This means that iOS devices won't be able to get the best video quality available on YouTube... but it's entirely Apple's fault for refusing to support DASH.

The question now is how do we detect that it's an iOS device or not (user agent could work, but it's not reliable)... and how do we adapt what is served.

@TheFrenchGhosty
Copy link
Member

A 20$ bounty has been added to this issue.

Anyone opening a PR fixing this issue, will receive 20$ (in BTC) from the Invidious project.

More details: #1898

@unixfox
Copy link
Member

unixfox commented Sep 1, 2021

I can provide access to my browserstack account if anyone is interested. Feel free to contact me with the email of my github profile if you are interested.

@unixfox
Copy link
Member

unixfox commented Sep 1, 2021

We discussed internally. The reason no one from the main team worked on this was that we had no way to test it easily (since we don't have any iOS device). This problem is now solved since we now have access to BrowserStack (a provider that gives access to real iOS devices).


The solution we discussed is to have HLS streams served to iOS devices (and keep using DASH for other devices), the reason being that HLS only support H.264 or H.265 (see https://www.cloudflare.com/learning/video/what-is-mpeg-dash/ ) while YouTube provides VP9/AV1 too.

This means that iOS devices won't be able to get the best video quality available on YouTube... but it's entirely Apple's fault for refusing to support DASH.

The question now is how do we detect that it's an iOS device or not (user agent could work, but it's not reliable)... and how do we adapt what is served.

Maybe @FireMasterK can help us about this.

@FireMasterK
Copy link
Contributor

I can give you my 2 cents - some versions of iPad OS actually have DASH working (likely a beta - someone told me about this in one of Piped's issues, it didn't work on my parents' device which runs a stable version) through MediaSourceExtensions, IOS just doesn't have it.

HLS support on IOS is purely native, and I really doubt that HLS has a indexRange (aka sidX boxes) alternative in its specification, which is essential for seeking and initializing the stream on a browser.

If I recollect correctly, HLS also requires an init segment which YouTube simply doesn't provide.

You're better of waiting for Apple to support DASH/MSE on IOS, and wait for the beta version on iPad OS to become a stable version. Even YouTube on Safari supports only 360p and 720p.

@unixfox
Copy link
Member

unixfox commented Sep 1, 2021

I can give you my 2 cents - some versions of iPad OS actually have DASH working (likely a beta - someone told me about this in one of Piped's issues, it didn't work on my parents' device which runs a stable version) through MediaSourceExtensions, IOS just doesn't have it.

HLS support on IOS is purely native, and I really doubt that HLS has a indexRange (aka sidX boxes) alternative in its specification, which is essential for seeking and initializing the stream on a browser.

If I recollect correctly, HLS also requires an init segment which YouTube simply doesn't provide.

You're better of waiting for Apple to support DASH/MSE on IOS, and wait for the beta version on iPad OS to become a stable version. Even YouTube on Safari supports only 360p and 720p.

How is piped doing for iOS? Is it providing HLS streams instead of dash?

@FireMasterK
Copy link
Contributor

How is piped doing for iOS? Is it providing HLS streams instead of dash?

If there's an LBRY stream, that would be played, else the best resolution is picked. (either, 720p or 360p)

@unixfox
Copy link
Member

unixfox commented Sep 1, 2021

How is piped doing for iOS? Is it providing HLS streams instead of dash?

If there's an LBRY stream, that would be played, else the best resolution is picked. (either, 720p or 360p)

But I don't understand how you are even providing the video streams in the first place.
Is this a shaka feature to disable dash and use straight the video file with .mp4?

@FireMasterK
Copy link
Contributor

Is this a shaka feature to disable dash and use straight the video file with .mp4?

Yes, I fall back to the muxed streams automatically, the MseSupport variable is used to tell whether or not a browser supports MSE/DASH.

See: https://github.com/TeamPiped/Piped/blob/a45b2b8380b831dda6f2eb44ba0b9aefe175c2e3/src/components/Player.vue#L96-L117

In the case of IOS, the final else clause is what is used/done.

@unixfox
Copy link
Member

unixfox commented Sep 1, 2021

In #2376 I allow forcing a default video quality for the player, if you set hd720 in the preferences then you will have a video in 720p when watching a video on safari for iOS.

Unfortunately implementing something like dash is going to be tough and hard to do, so until it's implemented at least you get a clear video in 720p instead of 144p like it was previously.

You can already try this pull request live on https://yewtu.be.

@Jerroder
Copy link
Author

Jerroder commented Sep 1, 2021

Isn't already the case? I've always seen that dash provides 144p on iOS but hd720 gives 720p

You gotta configure it per device though, I had to create 2 accounts, one for iOS devices (preference set to hd720) and one for everything else (set to dash - best)

@unixfox
Copy link
Member

unixfox commented Sep 1, 2021

Isn't already the case? I've always seen that dash provides 144p on iOS but hd720 gives 720p

You gotta configure it per device though, I had to create 2 accounts, one for iOS devices (preference set to hd720) and one for everything else (set to dash - best)

I completely excluded 144p from the available qualities so now it's 360p the minimal quality when dash is set in the preferences. With the merge of #2220 I think it was 144p even when hd720 was set so that's why I told here that I fixed an issue that got introduced by the PR #2220.

I'll see what to do because I think I can come up with something like default quality settings when dash is not available.

The best would be at one point to merge dash and the hd720, medium and small quality controls together.

@SamantazFox
Copy link
Member

The best would be at one point to merge dash and the hd720, medium and small quality controls together.

This is planned in #2377 :)

@unixfox
Copy link
Member

unixfox commented Sep 14, 2021

Note from @TiA4f8R:

Just saw again #2236 and I thought about something you can use for a fix: on player responses with the iOS client of the Innertube API, an HLS playlist is always returned for videos (streamingData.hlsManifestUrl).

@FireMasterK
Copy link
Contributor

Note from @TiA4f8R:

Just saw again #2236 and I thought about something you can use for a fix: on player responses with the iOS client of the Innertube API, an HLS playlist is always returned for videos (streamingData.hlsManifestUrl).

This has been implemented in Piped, now you can watch select videos in 1080p. However, youtube doesn't give streams >1080p.

Also: You don't need browser proxying for native HLS in IOS, however, Piped enforces it anyways.

@unixfox
Copy link
Member

unixfox commented Dec 29, 2021

Useful information: TeamNewPipe/NewPipeExtractor#680 (comment)

@unixfox
Copy link
Member

unixfox commented Jan 15, 2022

I'm for forcing the disable of dash when an iOS client is used until we implement HLS.

@unixfox
Copy link
Member

unixfox commented Sep 20, 2022

I'll take another crack at this issue because with the IOS client, Google straight gives a manifest URL that works out of the box with video.js on browsers that support HLS like Safari on MacOS. It is available under hlsManifestUrl.

But the issues:

  • We will have to do another request on top of the already multiple requests that we do for fetching a video.
  • hlsManifestUrl parameter is not available for other clients, so for age-restricted videos we won't be able to serve HLS stream to iOS and macOS users.
    For the two previous issues, we can solve this problem by generating ourselves the manifest file.
  • On HLS you can't control the video quality, that's ok for iOS users because DASH doesn't work there. But for Safari on MacOS or Android users, this will be one less control for the power users.
    We have two ways to solve this issue:
    • Only force HLS for iOS users.
    • Allow the ability to switch between HLS and DASH in the preferences.

But on the upside, here are the advantages:

  • HLS doesn't require to proxy the video for non encrypted videos, so we can straight serve the video stream from Google servers. I know it's not desired for everyone, but some people do like this ability to avoid any load on their server.
    The issue is that we will have to come up with a way that HLS automatically proxy the video if it encounters an issue.

@github-actions github-actions bot added the stale label Sep 20, 2023
@syeopite syeopite linked a pull request Sep 23, 2023 that will close this issue
@syeopite syeopite removed the stale label Sep 27, 2023
Copy link

This issue has been automatically marked as stale and will be closed in 30 days because it has not had recent activity and is much likely outdated. If you think this issue 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 Sep 30, 2024
@Ares4570
Copy link

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

This is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty bounty:20$ bug Something isn't working
Projects
Status: To Do - Player/Video playback
8 participants