-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation of Cef.RegisterWidevineCdm (#1935)
* 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
- Loading branch information
1 parent
a3c2fd4
commit 2298ea0
Showing
16 changed files
with
378 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright © 2010-2016 The CefSharp Authors. All rights reserved. | ||
// | ||
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. | ||
|
||
#pragma once | ||
|
||
#include "Stdafx.h" | ||
#include "CefWrapper.h" | ||
|
||
namespace CefSharp | ||
{ | ||
namespace Internals | ||
{ | ||
private class CefRegisterCdmCallbackAdapter : public CefRegisterCdmCallback | ||
{ | ||
private: | ||
gcroot<IRegisterCdmCallback^> _callback; | ||
|
||
public: | ||
CefRegisterCdmCallbackAdapter(IRegisterCdmCallback^ callback) | ||
{ | ||
_callback = callback; | ||
} | ||
|
||
~CefRegisterCdmCallbackAdapter() | ||
{ | ||
delete _callback; | ||
_callback = nullptr; | ||
} | ||
|
||
/// <summary> | ||
/// Method that will be called when CDM registration is complete. |result| | ||
/// will be CEF_CDM_REGISTRATION_ERROR_NONE if registration completed | ||
/// successfully. Otherwise, |result| and |error_message| will contain | ||
/// additional information about why registration failed. | ||
/// </summary> | ||
virtual void OnCdmRegistrationComplete(cef_cdm_registration_error_t result, | ||
const CefString& error_message) OVERRIDE | ||
{ | ||
auto r = gcnew CdmRegistration(); | ||
|
||
r->ErrorCode = (CdmRegistrationErrorCode)result; | ||
r->ErrorMessage = StringUtils::ToClr(error_message); | ||
|
||
_callback->OnRegistrationComplete(r); | ||
} | ||
|
||
IMPLEMENT_REFCOUNTING(CefRegisterCdmCallbackAdapter) | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
| ||
<html> | ||
<head> | ||
<script language="JavaScript"> | ||
function probeSupport() { | ||
var tests = []; | ||
var testKeySystems = [ | ||
'com.widevine.alpha', | ||
'org.w3.clearkey' | ||
]; | ||
|
||
var testCodecs = [ | ||
{ type: 'H.264', contentType: 'video/mp4; codecs="avc1.42E01E"' }, | ||
{ type: 'H.264/MPEG-4 AVC', contentType: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"' }, | ||
{ type: 'ogg', contentType: 'video/ogg; codecs="theora"' }, | ||
{ type: 'webm-vp8', contentType: 'video/webm; codecs="vp8"' }, | ||
{ type: 'webm-vp9-', contentType: 'video/webm; codecs="vp9"' } | ||
]; | ||
|
||
var basicVideoCapabilities = [ | ||
{ contentType: 'video/mp4; codecs="avc1.42E01E"' }, | ||
{ contentType: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"' }, | ||
{ contentType: 'video/webm; codecs="vp8"' }, | ||
{ contentType: 'video/webm; codecs="vp9"' } | ||
]; | ||
|
||
var basicConfig = { | ||
videoCapabilities: basicVideoCapabilities | ||
}; | ||
var configs = [basicConfig]; | ||
var support = { contentDecryptionModules: {}, playbackSupport: {} }; | ||
|
||
testKeySystems.forEach(function (keySystem) { | ||
var p = navigator.requestMediaKeySystemAccess(keySystem, configs) | ||
.then(function (access) { | ||
var config = access.getConfiguration(); | ||
support.contentDecryptionModules[keySystem] = "AVAILABLE"; | ||
}, function () { | ||
support.contentDecryptionModules[keySystem] = "NOT AVAILABLE"; | ||
}); | ||
tests.push(p); | ||
}); | ||
|
||
return Promise.all(tests).then(function () { | ||
var testEl = document.createElement("video"), | ||
mpeg4, h264, ogg, webm; | ||
testCodecs.forEach(function (testCodec) { | ||
var canPlay = testEl.canPlayType(testCodec.contentType); | ||
canPlay = canPlay !== "" ? canPlay : "no"; | ||
support.playbackSupport[testCodec.type] = { "contentType": testCodec.contentType, "supported": canPlay }; | ||
}); | ||
return support; | ||
}); | ||
} | ||
|
||
function printSupport(support) { | ||
var output = document.getElementById('output'); | ||
output.textContent = support; | ||
} | ||
|
||
function doTest() { | ||
probeSupport().then(function (support) { | ||
printSupport(JSON.stringify(support, null, ' ')); | ||
}); | ||
} | ||
</script> | ||
</head> | ||
<body onload="doTest()"> | ||
<pre id="output"></pre> | ||
<p> | ||
<a href="https://shaka-player-demo.appspot.com/demo/">Google Shaka Player demo - video play back</a> | ||
</p> | ||
<p> | ||
<strong>Note:</strong><br /> | ||
<ul> | ||
<li> | ||
Support for Widevine CDM requires additional steps as | ||
<a href="https://github.com/cefsharp/CefSharp/issues/1934">outlined here</a>. | ||
</li> | ||
<li> | ||
Use of proprietary codecs (such as H.264) requires a custom build of CEF to be used due to | ||
licensing requirements.<br /> | ||
Details on how to build the CEF project and other resources can be | ||
<a href="https://bitbucket.org/chromiumembedded/cef">found here</a>.</li> | ||
</ul> | ||
</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright © 2010-2016 The CefSharp Authors. All rights reserved. | ||
// | ||
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. | ||
|
||
using System; | ||
|
||
namespace CefSharp | ||
{ | ||
/// <summary> | ||
/// Represents the response to an attempt to register the Widevine Content Decryption Module (CDM) | ||
/// </summary> | ||
public class CdmRegistration | ||
{ | ||
/// <summary> | ||
/// If CDM registration succeeded then value will be <see cref="CdmRegistrationErrorCode.None"/>, for other values see the enumeration <see cref="CdmRegistrationErrorCode" />. | ||
/// </summary> | ||
public CdmRegistrationErrorCode ErrorCode { get; set; } | ||
|
||
/// <summary> | ||
/// Contains an error message containing additional information if <see cref="ErrorCode"/> is not <see cref="CdmRegistrationErrorCode.None"/>. | ||
/// </summary> | ||
public string ErrorMessage { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright © 2010-2016 The CefSharp Authors. All rights reserved. | ||
// | ||
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. | ||
|
||
using System; | ||
|
||
namespace CefSharp | ||
{ | ||
/// <summary> | ||
/// Lists the errors that can be reported during Widevine Content Decryption Module (CDM) registration. | ||
/// </summary> | ||
public enum CdmRegistrationErrorCode | ||
{ | ||
/// <summary> | ||
/// No error. Registration completed successfully. | ||
/// </summary> | ||
None, | ||
|
||
/// <summary> | ||
/// Required files or manifest contents are missing. | ||
/// </summary> | ||
IncorrectContents, | ||
|
||
/// <summary> | ||
/// The CDM is incompatible with the current Chromium version. | ||
/// </summary> | ||
Incompatible, | ||
|
||
/// <summary> | ||
/// CDM registration is not supported at this time. | ||
/// </summary> | ||
NotSupported, | ||
} | ||
} |
Oops, something went wrong.