shaka-project / shaka-player

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

Cannot cast widevine-encrypted vorbis content #7546

Open antoniori-eng opened 3 weeks ago

antoniori-eng commented 3 weeks ago

Have you read the FAQ and checked for duplicate open issues? Yes. I found no open issues involving Vorbis specifically. The same scenario with different codecs seems to work fine, so I suspect that this may be an issue related to Vorbis+Widevine specifically in the "Shaka Cast Demo Nightly" app (app ID 07AEE832).

If the problem is related to FairPlay, have you read the tutorial?

N/A

What version of Shaka Player are you using?

Shaka Demo Nightly Cast App, app ID 07AEE832

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

Can you reproduce the issue with the latest code from main? N/A

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

If custom app, can you reproduce the issue using our demo app? N/A

What browser and OS are you using? Casting to a "Chromecast with Google TV" device, from a chrome browser on a variant of Debian Linux.

For embedded devices (smart TVs, etc.), what model and firmware version are you using? This seems to repro on any cast device. I tested on a production "Chromecast with Google TV" device.

What are the manifest and license server URIs?

Manifest URL: https://www.gstatic.com/cast_3p/wv/live/vorbis/vorbis_1100hz.mpd License URL: https://cwip-shaka-proxy.appspot.com/no_auth

What configuration are you using? What is the output of player.getNonDefaultConfiguration()?

N/A (it's the shaka demo cast app running)

What did you do?

  1. Add "Custom Content" at https://shaka-player-demo.appspot.com/ using the license server and manifest listed above.
  2. Play the content, and note that playback in the browser works (the entire file can be played)
  3. Cast the content to a "Chromecast with Google TV"

What did you expect to happen? Playback should work on the TV with the "Chromecast with Google TV" plugged into it.

What actually happened?

Playback works for a few seconds, then stops (once it reaches the encrypted content). From debugging on a different cast device, it looks like the CDM is not being initialized. In the chromecast code, a CDM is never constructed. In the JS logs, I see Failed to load resource: the server responded with a status of 500 () cwip-shaka-proxy.appspot.com/no_auth:1

Are you planning send a PR to fix it? No

joeyparrish commented 3 weeks ago

Failed to load resource: the server responded with a status of 500 () cwip-shaka-proxy.appspot.com/no_auth:1

From this detail, it sounds like you had a license server failure.

Does it work with https://proxy.uat.widevine.com/proxy as the license server?

antoniori-eng commented 3 weeks ago

I see the same results with https://proxy.uat.widevine.com/proxy: playback works fine on the shaka demo website, but not on the cast device.

Sorry, I should have included this info in the original bug report, but the webpage shows "Shaka Error 6007". But again, only when casting (playing the content on the shaka demo site works fine).

joeyparrish commented 2 weeks ago

The license request failed. This could be a timeout, a network failure, or a rejection by the server. error.data[0] is a shaka.util.Error from the networking engine.

Do you have the error.data so we can see what the underlying network error was?

joeyparrish commented 2 weeks ago

Specifically the error data from proxy.uat.widevine.com/proxy, since we already saw an HTTP 500 error from the other license server.

antoniori-eng commented 2 weeks ago

How can I access error.data? Isn't that from shaka code? I'm just casting.

joeyparrish commented 1 week ago

If you can't access the Shaka error object directly in your cast receiver, can you send us the logs?

In the first version, you said:

In the JS logs, I see Failed to load resource: the server responded with a status of 500 () cwip-shaka-proxy.appspot.com/no_auth:1

These logs for the UAT proxy would be helpful. In fact, full logs would be ideal if you have them. Thanks!

antoniori-eng commented 1 week ago

There's not much in the logs, but here's a screenshot when casting and using the UAT proxy. Screenshot from 2024-11-14 16-27-35

joeyparrish commented 1 week ago

Okay, so HTTP 400 is the status from the UAT proxy.

Widevine's UAT proxy is rejecting the request for a license for this content, but it's not clear why. If you can capture the actual request from the dev console's network tab, and send a base64-encoded or hex-encoded version of it here, I should be able to decode it and use Widevine's partner tools to parse it. Understanding what's in the request should help.

If you can do the same for the license request from the browser, we can parse both and compare.

Finally, we can start a support request with Widevine armed with this information. Probably there is some older request format used by Cast devices, which Widevine's servers have stopped supporting. If we have details and can be specific, they may consider restoring compatibility with these older Widevine CDMs.

antoniori-eng commented 1 week ago

By the time I open the debugger, the license requests have already completed. If I try to cast the content again (or if I try to cast different content first and then cast the vorbis content), I get "Cannot read properties of undefined (reading 'length')" on the shaka demo website and nothing plays.

Are you able to repro the issue? It's happened on every cast device I've tried. Screenshot from 2024-11-15 09-59-20

avelad commented 1 week ago

@antoniori-eng what demo url are you using?

antoniori-eng commented 1 week ago

I'm just casting from https://shaka-player-demo.appspot.com/ with the custom content mentioned in the first comment: Manifest URL: https://www.gstatic.com/cast_3p/wv/live/vorbis/vorbis_1100hz.mpd License URL: https://cwip-shaka-proxy.appspot.com/no_auth (https://proxy.uat.widevine.com/proxy also fails)

Playback works in the browser, but fails when casting. Other codecs work fine when casting.

joeyparrish commented 1 week ago

What devices have you tried?

joeyparrish commented 1 week ago

I just reproduced the failure on an Android-based Chromecast, which is relatively recent. 😭

antoniori-eng commented 1 week ago

Interestingly, I did see it work on one cast device I tried just now: a Nest Hub Gen 2 (running Fuchsia).

It fails on every other device I've tried, though: "Chromecast with Google TV," a third-party LG TV, and a third-party Vizio TV. I have access to cast's logs on the LG TV, and I don't see a CDM being constructed.

joeyparrish commented 1 week ago

I managed to capture a request from a failing device. The request payload that fails seems to be JSON, not a Widevine license request.

{"kids":["IptDXMeUUEa-tPG-2RrfTg","iQZpI_CbUW-s8oVeKGq56Q","RBqKMeheXred76X9uSZ3kQ","I_2iX_r5UXe0YJvVmvEbbA","H4vznOorWcWcLoRuKPL07g"],"type":"temporary"}

To do this, I had to work around a UI bug (the Cannot read properties of undefined you mentioned). I'll put up a fix for it later.

joeyparrish commented 1 week ago

I think the player is selecting ClearKey, then sending a ClearKey request to a Widevine server. I'm not sure why this only happens while casting.

joeyparrish commented 1 week ago

The cast receiver attached to the demo is based on the nightly build. The nightly build plays this content just fine in the browser.

Casting with the nightly build results in error 6012, no license server given.

(Found a demo UI bug: if you specify an explicit key system ID in the asset config, it doesn't get saved.)

The demo's "custom asset" feature has some limitations. You can only configure one license server URI. So if the player fails to negotiate for a Widevine CDM on the cast device, it will fall back to clear key, but that single server URI means it will then send a clearkey license request to the Widevine server, which results in HTTP 400.

This weirdness is a limitation of the demo asset configuration AFAICT.

If I cast a version where I have stripped out the ClearKey parts of the MPD (https://storage.googleapis.com/shaka-demo-assets/_7546/wv-only.mpd), then I see error 6001, REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE.

For some reason, the cast device rejects the Player's request for a Widevine CDM.