shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.06k stars 1.33k forks source link

For this 1080p MPEG-Dash video, when casting to chromecast, max up to 720p only. #1505

Closed warking closed 6 years ago

warking commented 6 years ago

Have you read the FAQ and checked for duplicate open issues?: Yes

What version of Shaka Player are you using?: 2.4.2

Can you reproduce the issue with our latest release version?: Yes

Can you reproduce the issue with the latest code from master?: Yes

Are you using the demo app or your own custom app?: Demo app

If custom app, can you reproduce the issue using our demo app?:

What browser and OS are you using?: MacOS 10.13, Chrome 67.0.3396.99

What are the manifest and license server URIs?: manifest url: https://cdnapisec.kaltura.com/p/2082311/sp/208231100/playManifest/protocol/https/entryId/0_0cgrgqi2/format/mpegdash/tags/web_hd/f/a.mpd

What did you do? when casting that mpeg-dash url onto 2-gen chromecast, max to only 720p resolution. 1080p is the max resolution for that url and while playback in the browser, 1080p can be selected to play.

What did you expect to happen? cast to 2-gen chromecast and have 1080p video quality enabled in the select option

What actually happened? when casting that mpeg-dash url onto 2-gen chromecast, max to only 720p resolution. I don't know where the restriction applies.

vaage commented 6 years ago

@warking Could you provide me with some clarification?

When you say "max to only 720p resolution ... while playback in the browser, 1080p can be selected to play." are you saying:

warking commented 6 years ago

I meam the first one:

" that when you play on the ChromeCast, the max resolution you can manually select is 720p and when you play in a browser (not casting) the max resolution you can manually select is 1080p "

here is the screenshot: https://imgur.com/a/0J0IBeU

when casting to chromecast, that 3 1080p options gone. the best quality option in the select element becomes 720p

And I know that this may be a demo player thing rather than a library restriction but I don't find any code of those restriction.

sorry for the confusion caused by my vague expression

vaage commented 6 years ago

@warking I have been able to reproduce your issue and will start looking into it for you.

vaage commented 6 years ago

@warking, after some digging this is what I found. I hope it helps.

Inside the dash parser we call to the player interface's filterAllPeriods which will go through all the variants and will check if the variant is compatible with the platform. If you follow the call chain deep enough you will find a call to MediaSource.isTypeSupported.

This is where we ask media source if it can handle the content. Now on Chromecast we had to polyfill it as some codecs (while playable) cause problems if they are in the codec string. I checked and nothing in the pollyfill modifies your content’s mime type - so it's not a problem there.

However, when I started playing with cast.__platform__.canDisplayType, which the polyfill uses to test compatibility, I found that what it didn’t like was the avc1.640032 codec. To make sure this was not a false rejection, I forced it to return true and media source threw an error because it could not handle the content.

So it appears that there is something about the avc1.640032 codec that prevents the chromecast from playing that video stream. Thankfully Shaka Player detects it ahead of time and removes all variants that would use it.

vaage commented 6 years ago

Does that help?

warking commented 6 years ago

Thank you for your digging up and practice.

I just checked google cast sdk( https://developers.google.com/cast/docs/media ), it says the max video codec it supports is H.264 Level 4.1 while in another section of the page it states that chromecast ultra could support up to "HEVC / H.265 Main and Main10 Profiles up to level 5.1 (2160p/60fps)"

Do you happen to have an ultra to test if avc1.640032 works fine with the ultra?

vaage commented 6 years ago

@warking, our Lab is only set-up with a Chromecast Ultra, so all my original testing was with a Chromecast Ultra. The 1080p tracks do not appear because window.cast.__platform__.canDisplayType returns false when given 'video/mp4; codecs="avc1.640032";'.

warking commented 6 years ago

Got it. Thank you. It seems that chromecast has a lot work to do to catch up the modern high level codec stuffs