Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
Using widevine
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Using widevine
Hi,
The functions, classes and types are present in CEF4Delphi but I haven't tested them.
The functions, classes and types are present in CEF4Delphi but I haven't tested them.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Using widevine
To activate that plugin read the comments in the CEF3 source, here :
https://bitbucket.org/chromiumembedded/ ... ew-default
It's all in the file
/include/capi/cef_web_plugin_capi.h
To register the plugin read this :
https://bitbucket.org/chromiumembedded/ ... ew-default
It's all in the file
/include/capi/cef_web_plugin_capi.h
To register the plugin read this :
Code: Select all
///
// Register the Widevine CDM plugin.
//
// The client application is responsible for downloading an appropriate
// platform-specific CDM binary distribution from Google, extracting the
// contents, and building the required directory structure on the local machine.
// The cef_browser_host_t::StartDownload function and CefZipArchive structure
// can be used to implement this functionality in CEF. Contact Google via
// https://www.widevine.com/contact.html for details on CDM download.
//
// |path| is a directory that must contain the following files:
// 1. manifest.json file from the CDM binary distribution (see below).
// 2. widevinecdm file from the CDM binary distribution (e.g.
// widevinecdm.dll on on Windows, libwidevinecdm.dylib on OS X,
// libwidevinecdm.so on Linux).
// 3. widevidecdmadapter file from the CEF binary distribution (e.g.
// widevinecdmadapter.dll on Windows, widevinecdmadapter.plugin on OS X,
// libwidevinecdmadapter.so on Linux).
//
// If any of these files are missing or if the manifest file has incorrect
// contents the registration will fail and |callback| will receive a |result|
// value of CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS.
//
// The manifest.json file must contain the following keys:
// A. "os": Supported OS (e.g. "mac", "win" or "linux").
// B. "arch": Supported architecture (e.g. "ia32" or "x64").
// C. "x-cdm-module-versions": Module API version (e.g. "4").
// D. "x-cdm-interface-versions": Interface API version (e.g. "8").
// E. "x-cdm-host-versions": Host API version (e.g. "8").
// F. "version": CDM version (e.g. "1.4.8.903").
// G. "x-cdm-codecs": List of supported codecs (e.g. "vp8,vp9.0,avc1").
//
// A through E are used to verify compatibility with the current Chromium
// version. If the CDM is not compatible the registration will fail and
// |callback| will receive a |result| value of
// CEF_CDM_REGISTRATION_ERROR_INCOMPATIBLE.
//
// |callback| will be executed asynchronously once registration is complete.
//
// On Linux this function must be called before cef_initialize() and the
// registration cannot be changed during runtime. If registration is not
// supported at the time that cef_register_widevine_cdm() is called then
// |callback| will receive a |result| value of
// CEF_CDM_REGISTRATION_ERROR_NOT_SUPPORTED.
///
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Using widevine
I just uploaded a couple of functions to make widevine registration a little bit easier if you want to add it to your app :
CefRegisterWidevineCdm and CefFastRegisterWidevineCdm in uCEFMiscFunctions
CefRegisterWidevineCdm and CefFastRegisterWidevineCdm in uCEFMiscFunctions
Re: Using widevine
How correct use it?
I registered widevine after GlobalCEFApp.StartMainProcess
CefFastRegisterWidevineCdm(ExtractFilePath(Application.ExeName) +'cef\WidevineCdm',nil);
In folder I have widevinecdmadapter.dll, manifest.json, widevinecdm.dll
But I get this error
[0123/125602.424:ERROR:widevine_loader.cc(252)] Widevine CDM registration failed;
I registered widevine after GlobalCEFApp.StartMainProcess
CefFastRegisterWidevineCdm(ExtractFilePath(Application.ExeName) +'cef\WidevineCdm',nil);
In folder I have widevinecdmadapter.dll, manifest.json, widevinecdm.dll
But I get this error
[0123/125602.424:ERROR:widevine_loader.cc(252)] Widevine CDM registration failed;
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Using widevine
Hi,
I've never registered widevine. Use a callback procedure to know the error code and error text.
If you use CefFastRegisterWidevineCdm then set a TCefRegisterCDMProc procedure for the second parameter.
TCefRegisterCDMProc is defined in uCEFRegisterCDMCallback.pas and the TCefCDMRegistrationError error type is defined in uCEFTypes.
Here you have more info about licensing :
https://github.com/cefsharp/CefSharp/issues/1934
If you succeed, please let us know how!
I've never registered widevine. Use a callback procedure to know the error code and error text.
If you use CefFastRegisterWidevineCdm then set a TCefRegisterCDMProc procedure for the second parameter.
TCefRegisterCDMProc is defined in uCEFRegisterCDMCallback.pas and the TCefCDMRegistrationError error type is defined in uCEFTypes.
Here you have more info about licensing :
https://github.com/cefsharp/CefSharp/issues/1934
If you succeed, please let us know how!

Re: Using widevine
Thanks for your answer.
I set the OnCDMRegistrationComplete procedure to the second parameter, but after CefFastRegisterWidevineCdm I still get EAccessViolation error and don't get info about the CDM error.
I set the OnCDMRegistrationComplete procedure to the second parameter, but after CefFastRegisterWidevineCdm I still get EAccessViolation error and don't get info about the CDM error.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Using widevine
I'll take another look at the CEF4DElphi code to see if I missed something importing those functions.
I just read this :
https://bitbucket.org/chromiumembedded/ ... -component
Please, test your Widevine CDM binaries with the official sample application :
http://opensource.spotify.com/cefbuilds ... nt.tar.bz2
http://opensource.spotify.com/cefbuilds ... nt.tar.bz2
I'm not 100% sure but I think this could be the command line to test your binaries with cefclient :
I just read this :
https://bitbucket.org/chromiumembedded/ ... -component
Please, test your Widevine CDM binaries with the official sample application :
http://opensource.spotify.com/cefbuilds ... nt.tar.bz2
http://opensource.spotify.com/cefbuilds ... nt.tar.bz2
I'm not 100% sure but I think this could be the command line to test your binaries with cefclient :
Code: Select all
cefclient.exe --enable-widevine-cdm --cache-path=c:\temp\cache
Re: Using widevine
Hi!
I have problem with Widevine too. And I don't get error code.
I registerWidevine
I don't can get error code because I get EAccessViolation before OnCDMRegistrationComplete.
EAccessViolation is becase of TCefFastRegisterCdmCallback.Create(callback) as ICefRegisterCdmCallback (if it is replaced by Nil, the EAccessViolation will disappear, but I do not know why the library is not registered)
In log.txt
[0329/193006.900:ERROR:widevine_loader.cc(252)] Widevine CDM registration failed;
manifest.json and library is ok (works in other cef apps)
I have problem with Widevine too. And I don't get error code.
I registerWidevine
Code: Select all
if GlobalCEFApp.StartMainProcess then
begin
CefFastRegisterWidevineCdm(ExtractFilePath(Application.ExeName) +'cef\Widevine',OnCDMRegistrationComplete);
...
end;
Code: Select all
procedure OnCDMRegistrationComplete(result: TCefCDMRegistrationError; const error_message: ustring);
begin
showmessage('error');
end;
EAccessViolation is becase of TCefFastRegisterCdmCallback.Create(callback) as ICefRegisterCdmCallback (if it is replaced by Nil, the EAccessViolation will disappear, but I do not know why the library is not registered)
In log.txt
[0329/193006.900:ERROR:widevine_loader.cc(252)] Widevine CDM registration failed;
manifest.json and library is ok (works in other cef apps)
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Using widevine
I've added a GlobalCEFApp.WidevinePath property and a GlobalCEFApp.OnCDMRegistrationComplete event to do this automatically.
I can't test it with real Widevine files but the function works and the event is received.
I'll upload this soon...
I can't test it with real Widevine files but the function works and the event is received.
I'll upload this soon...
Re: Using widevine
Thanks for the update! I found a error and fixed it. Now I get CEF_CDM_REGISTRATION_ERROR_NONE, but widevine still doesn't work.
Salvadordf, maybe you will try?
My widevineCdm - https://www.dropbox.com/s/opr5zyzykvhco ... m.zip?dl=0
My code:
I check status of the widevine on this site - https://bitmovin.com/mpeg-dash-hls-drm-test-player/
Salvadordf, maybe you will try?
My widevineCdm - https://www.dropbox.com/s/opr5zyzykvhco ... m.zip?dl=0
My code:
Code: Select all
GlobalCEFApp.AddCustomCommandLine('--enable-widevine-cdm', '');
GlobalCEFApp.AddCustomCommandLine('--cache-path', ExtractFilePath(ParamStr(0)) + 'cef\cache');
GlobalCEFApp.OnCDMRegistrationComplete := OnCDMRegistrationComplete;
GlobalCEFApp.WidevinePath := ExtractFilePath(Application.ExeName) +'cef\WidevineCdm';
if GlobalCEFApp.StartMainProcess then
...