Chromecast Casting DRM content has still problems

Hi @Lukas

As per your request I’m starting new thread for my still present problem when casting DRM videos to chromecast ( using bitmovin of course ).

I have version 3.32.0 as you’ve suggested.

Video X, is playing well on the phone but when casting to Chromecast I have following errors :

PlayerEvent : Warning(code=RemotePlaybackFailed, message=
A media error occurred on the connected cast-compatible device:
 Reason: null
 Type: ERROR
 Detailed error code: 201
onPlayerEvent: OnWarning(code=RemotePlaybackFailed, message=
A media error occurred on the connected cast-compatible device:
Reason: null
Type: ERROR
Detailed error code: 201

Some videos works, some not, I’m using videvine for DRM. I’ve read a lot about such problems and this situation points to CORS issue, so some videos are working some not.

I hope that we can resolve that.

Should we add something on player side ?
Or maybe we should add something on receiver side ? We are using your default receiver ID that is embeded in your library,

Or maybe we should add something on videos provider side ? ( not preffered )

Hi @michal.rabinski , thanks for sharing the cast failure logs. Looking at the error message the error code is 201. As per Google cast error codes, error 201 is MEDIAKEYS_NETWORK which suggests the issue is related to DRM license request.

To find a solution, we need to understand the exact issue. For this please following the steps provided in Bitmovin Docs - Player Tutorials | How to debug streams on Chromecast devices to get cast receiver logs and network request for failing sessions. This will help understand the exact issue leading to this error and thus also finding a solution for the same.

Please let us know if you have any questions on debugging cast receiver.

Thanks and Regards,
Lucky Goyal

1 Like

Hi @michal.rabinski , hope you had a good start to the week. Just checking in if you got chance to capture the logs on CAST receiver using the steps provided in cast receiver debugging tutorial.
Please let us know if there are any questions around cast receiver debugging.

Hi @lucky.goyal

I’m just getting warmed up and preparing to debug it.
I’ve tried to test CAST receiver on my own before.
I’ve wanted to test custom receiver from google samples but with no luck to run it.

Ok let’s be on the same page.

  • I’m going to test receiver that is stated in your code FFE417E5
  • I’m gonna use this cast console https://cast.google.com/publish/ , I’ve already have account there
  • Today I will try to somehow add your receiver

Main question : Can I use your receiver ? I doubt it somehow because I need URL to FFE417E5 but I probably can’t have that and without it I can’t test it.

I do not have my own receiver. Or maybe I don’t need to provide my own application ?

Great to hear that. In order to inspect/debug the receiver you will indeed need to deploy a CAF receiver URL using your your https://cast.google.com/publish/ account and you should also register your Chromcast device to this account.

For the CAF receiver, I will suggest to clone GitHub - bitmovin/bitmovin-player-caf-receiver: CAF receiver implementation to communication with Bitmovin Player SDKs, build and deploy it on cloud storage.

The above Github repo is the source code for Bitmovin reference CAF receiver application(app id FFE417E5). The README.md file provides steps to build and deploy.

OK

I’ve placed receiver content from github repo on remove place and checked that I have access there.

I pasted URl path to that repo
Index.html is inside src folder but I pointed to parent dir, when I’m running link in web browser that pointed to src folder I have a little preloader on bottom of the screen, and when to src/index.html I also have this preloader so I am assuming that It’s the same ( or not ? )

I provided path to my app’s package to test it on target environment but maybe I would need to switch to your sample bitmovin project.

I’m providing my Id like that :slight_smile:

BitmovinCastManager.initialize("28DDFAB5","urn:x-cast:com.bitmovin.player.caf")    

I needed to provide messageNamespace to make it work, I’m using your message namespace from inside of implementation.

Then I’m trying to cast but there is only black screen blink on my TV and I’m back to chromecast main screen. Something is not starting

Let me re-iterate what I understood so far. Please confirm if you followed these steps?

  • Cloned/downloaded CAF receiver sample code from GitHub - bitmovin/bitmovin-player-caf-receiver: CAF receiver implementation to communication with Bitmovin Player SDKs

  • Built the CAF receiver app by using npm ci and npm run build commands in the cloned/downloaded repo

  • The build step will create 2 files in dist folder in the repo

    • index.html
    • BitmovinCafReceiver.js
  • Copied above 2 files into a cloud storage or hosted on some public HTTP server and confirmed that both are accessible over internet.

  • Added the public URL of index.html to your Google cast device as App id. And your app Id is 28DDFAB5

  • Once you have done above, then you can use the CAF receiver using below. The namespace used by you is correct.

BitmovinCastManager.initialize(“28DDFAB5”, “urn:x-cast:com.bitmovin.player.caf”)

With above steps you should be able to get the casting playback working.

Hi @lucky.goyal , i missed this npm step :wink:

I’m not webdeveloper so I need your help here :slight_smile:

I’ve run those two commands and there are some errors, here are logs

One after

npm ci

Ms-MacBook-Pro:bitmovin-player-caf-receiver mr$ npm ci
npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile 
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile 
npm WARN deprecated ini@1.3.5: Please update to ini >=1.3.6 to avoid a prototype pollution issue
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated fsevents@2.1.3: "Please update to latest v2.3 or v2.2"
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.

added 455 packages, and audited 456 packages in 9s

17 packages are looking for funding
  run `npm fund` for details

20 vulnerabilities (1 low, 1 moderate, 16 high, 2 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

Do I need to run such updates/fixes suggested by output ?

As for

npm run build

I have following output :

Ms-MacBook-Pro:bitmovin-player-caf-receiver mr$ npm run build

> caf-receiver@1.0.0 build
> webpack --env prod --mode production

/PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/loader-runner/lib/LoaderRunner.js:133
if(isError) throw e;
^

Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (/PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/webpack/lib/NormalModule.js:471:10)
at /PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/webpack/lib/NormalModule.js:503:5
at /PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/webpack/lib/NormalModule.js:358:12
at /PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
at /PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/loader-runner/lib/LoaderRunner.js:236:3
at context.callback (/PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at makeSourceMapAndFinish (/PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/ts-loader/dist/index.js:59:5)
at successLoader (/PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/ts-loader/dist/index.js:41:5)
at Object.loader (/PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/ts-loader/dist/index.js:24:5)
at LOADER_EXECUTION (/PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/loader-runner/lib/LoaderRunner.js:119:14)
at runSyncOrAsync (/PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/loader-runner/lib/LoaderRunner.js:120:4)
at iterateNormalLoaders (/PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
at Array.<anonymous> (/PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
at Storage.finished (/PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
at /PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
at /PathToMyDownloadsFolder/bitmovin_receiver/bitmovin-player-caf-receiver/node_modules/graceful-fs/graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
    opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
    library: 'digital envelope routines',
    reason: 'unsupported',
    code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v18.14.2

After executing those two commands I don’t have

dist

folder created but it created

node_modules

folder

Maybe there is something else missing ?

Hi @michal.rabinski , thanks for trying out the steps and sharing the issue encountered. First of I would say that you are on right track. I think the issue that you faced is related to dev enviornment.

The issue is coming because of incompatibility with node v18.14.2 installed on your system. Can you please install Node version 16.x or lower and redo the steps again? I confirmed that I get same error when using node version v18.14.2 but build works fine when using node version v16.19.1

Please create a clean build by removing node_modules folder and reverting any other changes for example in package-lock.json etc.? You can also do a fresh clone to start from a clean slate.

Please try this and let us know if you still face a build issue.

Hi @michal.rabinski , hope your are well. Please let us know if you could get the build to work or if you need any assistance.

Hi! @lucky.goyal Hello and I hope you are well.

I’ve managed to place compiled files :

BitmovinCafReceiver.js
index.html

into remote destination and I have access to it.
To prove it here is html code from chrome dev console
( please note that at the bottom center of the screen there is circular animated preloader visible )

But When I’m trying to cast, then my tv ( with chromecast ) goes black and after while comes back and I don’t know what the reason behind this :frowning:

May it be incorrectly registered Chromecast Device ? I think I did it right

I also thought that it may be something with incorrectly provided package name to my android app but from what I’ve read there is no need to provide android package when receiver application is in unpublished state so I even unpublished it yesterday but still the same black screen is present.

I’ve also tried you sample app to get rid of any unknown factors from my app but the result is the same, and of course I’m using 3.32.0 version of bitmovin player

thanks for the update @michal.rabinski . Can you please share the link to your hosted index.html and BitmovinCafReceiver.js so that I can test it at my end. Please DM the links if not possible to share here.

@lucky.goyal after many many tries I managed to successfully cast content to those receiver I placed on remote location so success :slight_smile: publishing receiver turns out to be necessary. Besides I used original chromecast not this from Xiaomi.

As for link to receiver, no problem I can send you it in DM.

But now I have another issue ( I had it before when experimenting with receivers )

There is no inspect button on my chromecast. ( Near Chromecast entry )

I assume that I’m running

chrome://inspect/#devices:

from chromecast on my computer, not on my Android phone, is it correct ?

Here is what I’m seeing now

@michal.rabinski , that’s great progress.

I tried the Cast receiver you DM’ed and could use it for casting and inspection, so received publishing seems fine.

Regarding the issue of inspect button not showing up.

  • chrome://inspect/#devices is the correct link and as shown in screenshot you shared, the Chromecast device is also visible
  • The inspect button only appears when casting is in progress
  • Please make sure that your Chromecast device is registered for testing in your cast device account https://cast.google.com/publish/#/overview
    Pls see a screenshot showing the registered cast device.

That’s great news about receiver.

Yes, I registered it many times, because it has a ton of id’s printed on and I don’t know which one is valid. Google suggested to get S/N from the box but with no box, there is no Serial Number…

I tried different S/N, I think that one of them should be valid. Or maybe zero’s were in fact "O"s and I can put it also with that variant…

I will try to find a way to locate S/N from GoogleHome app somehow

Hi @lucky.goyal

Today inspect button is visible and I’m ready to debug :slight_smile: Maybe device restart helped somehow.

Ok, now to begin : I’ve loaded exact video that I had problem with, I mean, it works inside player but I’m unable to cast it.

Where to find some info about problem ?

I have this console opened and logs are here :

Access to fetch at <url to movie> ==' from origin '<DOMAIN WHERE RECEIVER IS>' 
has been blocked by CORS policy: No 'Access-Control-Allow-Origin' 
header is present on the requested resource. If an opaque response 
serves your needs, set the request's mode to 'no-cors' to fetch the 
resource with CORS disabled.

So I turned out that it’s CORS issue.
From what I know we either should place crossdomain xml on the movie distributor place ( not recomended because it can be hard to archieve )

OR maybe there is some I don’t know, header or something to fix it on our site ? ( probably not :frowning: )

So maybe this hint is pointing to the right direction :

set the request's mode to 'no-cors' to fetch 
the resource with CORS disabled.

Hi @michal.rabinski , great that you are able to debug the cast receiver now. Can you please share the full console logs as well as network logs from cast receiver debugger?

If possible please also share the source config so that I can replicate the same on my side. Please feel free to DM the information.

Hi @lucky.goyal
I’ve sent you full logs.
What kind of source config do you need ? You mean video url and license?

Hi @michal.rabinski , thanks for sharing the console logs. From the logs, it seems that you need to work with the DRM server vendor to get your CAF app domain allow-listed for DRM license requests. Normally DRM vendors would prevent cross domain access from un-authorized domains but they should be able to allow cross domain access to your applications domains.

Hi @lucky.goyal , first of all thank you for your help in debugging it.
It turned out that those videos that are working were on different server than those not working ones. I think they need to somehow whitelist me.
For now I think case is closed at least from Bitmovin side.

2 Likes