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
Implementation of Cef.RegisterWidevineCdm #1935
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4f7ea22
Added Cef.RegisterWidevineCdm for CEF Widevine CDM registration #1934
justinstenning 442f311
Added test page for WidevineCdm registration and example registration…
justinstenning eb2459e
Noted additional steps for Widevine and proprietary codecs to CdmSupp…
justinstenning aa7de2e
Link for more information changed to issue #1934 in CefExample.cs
justinstenning c554b76
replaced Cef.RegisterCdmCallback's async result with IRegisterCdmCall…
justinstenning 9cb80e5
RegisterCdmCallback now uses taskCompletionSource
justinstenning File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be some sort of disclaimer here that explains
widevine CDM
requires additional steps to enable andpropritary
codes are not supported in the defaultNuget
packages as they require licensing.What happens if you open this page with a default build?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Widevine not registered and not using proprietary codecs just says that widevine is "NOT AVAILABLE", and some of the codecs are listed as not supporting playback.
I'll add a note at the end of the page re proprietary codecs and contacting Widevine for access to widevine - and a link to the issue #1934.