castlabs / electron-releases

castLabs Electron for Content Security
https://castlabs.com/resources/downstream/
MIT License
222 stars 42 forks source link

Binge encryption error #131

Closed coreybruce closed 2 years ago

coreybruce commented 2 years ago

DRM videos were wroking my my Binge desktop application but now I have had this issue for multiple users on their computers using both Linux and Windows using v19.0.6+wvcus, I tried v17.4.10+wvcus but I get the same issue.

Unknown Encrypted Error
Sorry, an unidentified encrypted error has caused playback to fail. Please check your browser and try again.

InvalidStateError: Failed to execute 'update' on 'MediaKeySession': Rejected with system code (72)

UDID:
0a339a8e-d8fd-4322-9453-dce9eb367907
khwaaj commented 2 years ago

It is really difficult to tell for sure without more information about the implementation, but these kinds of errors is often triggered in the EME layer, e.g. due to not handling other errors correctly, a race condition, or breaking some rule of the system (the CDM can be quite sensitive at times). IIRC this error, 72, means that a parameter passed to the CDM is NULL, so there is likely some error with the input data to the update() call.

coreybruce commented 2 years ago

Hmm I see well here is my code, I am using it the way you guys documented to use it and auto downloads widevine

https://gitlab.com/binge-desktop/application

khwaaj commented 2 years ago

It looks like you are just creating a simple wrapper around the web-page, so if EME is the culprit the change that caused it could be there. Or there could be some stability issues with their DRM provider. When did the problem start, and how often does it occur? Does it also occur in Chrome?

coreybruce commented 2 years ago

Oh okay I see, I wonder what the issue is exactly?

This started a week ago and I tested it on Edge at the time because my sister had to resort to it to watch The Walking Dead with me but I just tested it on my girlfriends laptop and on Google Chrome 103.0.5060.114 it's also having the same issue and when I check the components and check for updates it will say not updated but has Widevine 4.10.2449.0

Is electron also having a issue downloading it?

khwaaj commented 2 years ago

The reason it says "not updated" is that 4.10.2449.0 is the latest version available, not that it failed to update. If you get an actual install error the message should be different.

ECS 16 and later use the exact same mechanism for installing CDM updates as Chrome/Chromium does, so you will have the same CDM installed. Since you are seeing the same issue in Chrome the error is almost definitely on the Binge web site (or with their DRM provider), not in ECS.

coreybruce commented 2 years ago

Hmm okay I see, I just tried Firefox and Edge on Linux and now even Edge is having the same issue so it must be a Binge related problem.

coreybruce commented 2 years ago

Oh my notebook it's still working, you sure it doesn't have anything to do with it managing or download widevine?

EDIT: I can confirm that there is definitely something wrong with Electron managing DRM for certain video platforms, after deleting the binge folder in .config and letting it regenerate the folder and files while also downloading widevine I am now getting the unknown encryption error. I can see it's missing a bunch of files including the libwidevinecdm.so file in Widevinecsm and a couple other files

Would you like to look at my working config folder for Binge?

coreybruce commented 2 years ago

Folder with files before this started happening image

Folder missing files with current version image

It looks like it's not setting up the files correctly

khwaaj commented 2 years ago

I can't be completely sure of the cause since I can't reproduce the problem (I don't have a Binge account), but I'm very confident that the issue is not with ECS itself since you are seeing the same issue on Chrome.

About the CDM installation, the files you are missing are the files installed by ECS versions prior to 16, which are labeled wvvmp. These releases uses Lorry and installs the CDM directly in the WidevineCdm directory. The more recent releases, labeled wvcus, uses the Component Updater Service (CUS) and installs the CDMs in the versioned directories below WidevineCdm instead (if you dig deeper into those you should find a CDM binary in each version directory). So the "extra" files you are seeing on your laptop are residual files from a prior ECS installation. Btw, what does the log message from whenReady() where you log components.status() say? It should tell you which CDM version is in use and if it was updated.

I'm not sure why things stopped working when you removed/regenerated your Binge directory, but there could be a lot of state in there that is now missing or different. This includes cookies, which could have held state information that affects how the Binge site behaves.

coreybruce commented 2 years ago

Hmm alright

Here is the on ready log

components ready: {
  oimompecagnajdejgnnjijobebaeigek: {
    name: 'Widevine Content Decryption Module',
    status: 'new',
    version: '4.10.2449.0'
  }
}
khwaaj commented 2 years ago

Ok, that looks good then. I'm using the same CDM for my tests with other streaming sites and everything is working fine.

coreybruce commented 2 years ago

Yeah but not sure why it's no longer working for Binge

khwaaj commented 2 years ago

Everything points to some kind of problem on their side, either in their EME implementation (see InvalidStateError and update()) or something related. Maybe they pushed an update that broke something on their site, or there is some problem with the DRM service provider or authentication (which could explain why your laptop worked, if it still had a valid token).

coreybruce commented 2 years ago

After reporting it the issue has been fixed.

Thanks for the replies 😊

khwaaj commented 2 years ago

Thats good news. I guess we can close this then, unless there are further complications?

coreybruce commented 2 years ago

Yeah I will close the issue. Thanks for the help.