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

Feature Request - Expose CefRegisterWidevineCdm #1934

Closed
justinstenning opened this issue Feb 12, 2017 · 15 comments
Closed

Feature Request - Expose CefRegisterWidevineCdm #1934

justinstenning opened this issue Feb 12, 2017 · 15 comments

Comments

@justinstenning
Copy link
Contributor

justinstenning commented Feb 12, 2017

With CEF no longer using the component updater to download Widevine CDM it is necessary to expose the CefRegisterWidevineCdm function in order to support DRM content.

The relevant CEF issue outlining the change with linked changesets: https://bitbucket.org/chromiumembedded/cef/issues/2009/dont-download-widevine-cdm-using-component

Once implemented, the new process to support Widevine involves the following steps:

  1. Request a Widevine license by contacting Google via the Widevine contact page: https://www.widevine.com/contact.html. You must then request the Widevine CDM binary download details.
  2. Within your application download the Widevine binaries and prepare the manifest.json
  3. Call Cef.RegisterWidevineCdm passing in the path to the Widevine binaries and optionally an IRegisterCdmCallback. For async/await you can use Cef.RegisterWidevineCdmAsync again passing in the path.
@justinstenning
Copy link
Contributor Author

justinstenning commented Feb 13, 2017

A typical WidevineCdm setup for Windows x64 will contain the following files:

  • manifest.json
  • widevinecdm.dll
  • widevinecdmadapter.dll

Example bare-bones manifest.json file:

{
  "version": "1.4.8.903",
  "x-cdm-module-versions": "4",
  "x-cdm-interface-versions": "8",
  "x-cdm-host-versions": "8",
  "x-cdm-codecs": "vp8,vp9.0,avc1",
  "os": "win",
  "arch": "x64"
}

Assuming all located in .\WidevineCdm it can be registered with:

Cef.RegisterWidevineCdm(@".\WidevineCdm");

justinstenning added a commit to justinstenning/CefSharp that referenced this issue Feb 13, 2017
amaitland pushed a commit that referenced this issue Feb 13, 2017
* Added Cef.RegisterWidevineCdm for CEF Widevine CDM registration #1934
* Added test page for WidevineCdm registration and example registration #1934
* Noted additional steps for Widevine and proprietary codecs to CdmSupportTest.html
* Link for more information changed to issue #1934 in CefExample.cs
* replaced Cef.RegisterCdmCallback's async result with IRegisterCdmCallback parameter
* RegisterCdmCallback now uses taskCompletionSource
@amaitland amaitland added this to the 57.0.0 milestone Feb 13, 2017
@amaitland
Copy link
Member

@spazzarama Are you using a CEF build with proprietary codec support? Did you obtaining the relevant licenses or obtain legal advise regarding using proprietary codecs in your app?

@justinstenning
Copy link
Contributor Author

justinstenning commented Feb 13, 2017

@amaitland we have done some test builds with a CEF build including proprietary codec support in order to get everything proven. Widevine licensing sorted and I believe the process is underway re www.mpegla.com and AVC/H.264

@amaitland
Copy link
Member

Widevine licensing sorted and I believe the process is underway re www.mpegla.com and AVC/H.264

Cool 👍 Do you have any tips or additional information that might be relevant to others? (I personally have no interest, so I've never looked into it further).

@justinstenning
Copy link
Contributor Author

justinstenning commented Feb 13, 2017

Let's say for example, that you have a requirement to have a CefSharp build that works with Netflix. You need to sort out the following:

Widevine Licensing:

  1. Use the contact form on the Google Widevine site (https://www.widevine.com/contact.html). A person with authority in the company / group requesting the license must sign a contract etc... This process is reasonably fast and simple. There is no cost.
  2. You then need to request details for the binary download. I had to refer them to the CEF issue and explain that it was for use with Chromium Embedded Framework and the platform(s) we were interested in.

It probably took around 6-8 weeks for this entire process, but this included Christmas time.

AVC/H.264 Licensing:

Head over to http://www.mpegla.com/main/programs/AVC/Pages/AgreementExpress.aspx and contact the Licensing Department requesting the AVC/H.264 details. I believe the costs are $0 for first 100k units but don't quote me and do your own investigation, there is no doubt contracts to sign etc. At this point I handed over to someone else so can't provide any more input - I'll update if I get more info.

CEF - proprietary codec build:

  1. Setup CEF build environment (massive download and setup time). Check the build instructions at https://bitbucket.org/chromiumembedded/cef
  2. Build using a batch file similar to following (fast machine and drive - it takes many hours and requires between 40-50GB of space available): change the --branch=2924 value accordingly
set CEF_USE_GN=1
set GN_DEFINES=is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome
set GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*
set CEF_ARCHIVE_FORMAT=tar.bz2
python automate-git.py --download-dir=d:\projects\cefsource --branch=2924 --minimal-distrib --client-distrib --x64-build --depot-tools-dir=d:\projects\depot_tools

For 32-bit - just remove the --x64-build above

CEF -> CefSharp:

  1. It is easiest to reuse the cef-binary NuGet packaging project https://github.com/cefsharp/cef-binary .
    1. You need to create a custom PowerShell script that works with the locally built CEF binaries instead of downloading them (we just modified the existing one to retrieve local files instead of downloading). Also update the CefVersion string to match what you have built.
    2. As we reused most of the cef-binary logic we needed to create a cef-versions.json file that contains the versions matching the custom CEF build.
  2. Change your CefSharp projects to use a local NuGet repo and specify the packages we just created for CEF (i.e. point to a folder location or whatever)
  3. Build and package CefSharp into a NuGet package for local use
  4. Use the resulting NuGets along with the CEF ones as a local repo in your project (or whatever NuGet repo you need)

In your project:

  1. Use the NuGets from above
  2. Add logic to download the Widevine binaries and place in an appropriate directory and call Cef.RegisterWidevineCdm to intiailize.
  3. Good to go! Netflix should now function (also the Shaka player demo is a good test, and the test page within the CefSharp Wpf Example if you uncomment the CefExample.cs Cef.RegisterWidevineCdm and copy the widevine binaries to the correct spot)

@amaitland
Copy link
Member

You will want to update the CefSdkVer in NuGet/cef.sdk.props

The powershell script does that already.

You need to create a custom PowerShell script that works with the locally built CEF binaries instead of downloading them (we just modified the existing one to retrieve local files instead of downloading). Also update the CefVersion string to match what you have built.

By all means submit a PR that improves this, would require minimal effort to add support for using a version from disk.

@justinstenning
Copy link
Contributor Author

The powershell script does that already.

Ok thanks, its been a while since I did it and was just comparing the source files 👍

By all means submit a PR that improves this, would require minimal effort to add support for using a version from disk.

I'll see how I go for time, either that or I will attach somewhere for reference.

@vwmberry95
Copy link
Contributor

Not sure if this is the best spot, but I wanted to report my findings...

I ran my app on another device with the same Widevine files and was getting the IncorrectContents response. I went into Chrome on the same device and no components were installed, so I updated the Widevine component. I restarted my app and Widevine started giving the None response and protected content started working.

I wonder if there's a registry value that gets created when Chrome downloads the component? I'll report back if I find anything.

@mbragg12
Copy link
Contributor

mbragg12 commented Apr 26, 2018

The actual implementation was done in this story:
#1935

I have it working on systems without Chrome. The system may be missing one the dependency DLL's and Chrome installs it.

@seikosantana
Copy link

I'm not too much experienced but can't we use OpenH264 instead of Chromium builds. or does it also needs licensing even though we are using OpenH264?

@amaitland
Copy link
Member

I'm not too much experienced but can't we use OpenH264 instead of Chromium builds

Unfortunately no.

@amaitland
Copy link
Member

The manual method of registering Widevine is being removed in version 93. CEF will automatically download Widevine at runtime.

#3767

@ukandrewc
Copy link

Excellent, that's going to save me a job ;-) I was just trying to get that working.

@Sonalkalbande
Copy link

Sonalkalbande commented Aug 30, 2021

@amaitland Could you please confirm if all the other processes of getting license from Widevine, building later version of CEF manually with Codec flag remains same for Cefsharp integration, or that has been changed too?

@amaitland
Copy link
Member

https://bitbucket.org/chromiumembedded/cef/issues/3149/alloy-add-component-updater-support-for details the changes. That is all the information I have on the subject.

You can ask follow up questions at
https://magpcss.org/ceforum/index.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants