Navigation Menu

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

feat: silently try com.microsoft.playready.recommendation before com.microsoft.playready #2750

Closed
Closed
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
9354f04
feat: use playready recommendation when using robustness or persisten…
valotvince Jul 22, 2020
678e005
fixing lint
valotvince Jul 22, 2020
7925fb2
fixup wrong assignment
valotvince Jul 22, 2020
ed41a9d
unpack reco
valotvince Jul 22, 2020
d20cee1
add documentation
valotvince Jul 23, 2020
021306b
fixup type
valotvince Jul 23, 2020
b011cfc
fixup typo, lines length & add more insight on robustness
valotvince Jul 24, 2020
e7e045d
add some more rules for recommendation
valotvince Jul 24, 2020
a5733e1
add initDataTypes
valotvince Jul 24, 2020
d524b02
enforce sessionTypes to persistent-license
valotvince Jul 29, 2020
c29c6b1
enforce persistent sessionType in MediaKey createSession
valotvince Jul 29, 2020
3adf032
set config initDataTypes from initData
valotvince Jul 31, 2020
90eae8a
prevent null access, re-order for cast priority, fixup some tests
valotvince Jul 31, 2020
dc4ddaf
add more tests
valotvince Aug 3, 2020
740abc9
remove useless addings
valotvince Aug 3, 2020
785072b
fixup linting
valotvince Aug 5, 2020
4d164f5
add default initDataTypes if not provided
valotvince Aug 10, 2020
f052a7e
fixup unit tests
valotvince Aug 10, 2020
89db3a0
fix wrongly moved line
valotvince Aug 10, 2020
1a9cb6f
review
valotvince Nov 2, 2020
c0c88dd
redo nitpicks
valotvince Nov 2, 2020
dfb1de5
fixup variant detection
valotvince Nov 2, 2020
0c38322
fix nitpicks
valotvince Nov 2, 2020
1ad81c8
fixup unit tests
valotvince Nov 2, 2020
fbff53c
enforce persistent-license session when persistentStateRequired
valotvince Nov 3, 2020
fb0897c
test recomendation on Edge only
valotvince Nov 3, 2020
7fe9fc8
add a sessionType configuration in advanced config
valotvince Nov 4, 2020
96c85cc
update unit tests
valotvince Nov 4, 2020
5940905
review
valotvince Nov 11, 2020
a1f3503
fixup code style
valotvince Nov 18, 2020
7d4b1ed
fixup after rebase
valotvince Feb 23, 2021
ab6e143
remove session if they were persistent in playback
valotvince Feb 23, 2021
9aa90a1
add PlayReady cast inside the playready systems, remove IE check, rev…
valotvince Mar 15, 2021
9d8fcda
change DrmInfo sessionTypes to sessionType to match shaka configurati…
valotvince Mar 15, 2021
0209264
code styling fixes
valotvince Mar 15, 2021
0cf8d7a
remove some references to IE11
valotvince Mar 15, 2021
e229bde
add documentation on a potential fallback fail
valotvince Mar 16, 2021
a1a832a
code style adjustment
valotvince Mar 17, 2021
70a5652
hopefully fix tests on cast platform
valotvince Mar 19, 2021
94bd5e2
prevent playing Edge test on other platforms
valotvince Mar 19, 2021
fe65b22
prevent removing created sessions for storage
valotvince Mar 19, 2021
64efd53
correctly set configKeySystem when initiating DRM engine for removal
valotvince Mar 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion demo/common/asset.js
Expand Up @@ -357,13 +357,14 @@ const ShakaDemoAssetInfo = class {
*/
getConfiguration() {
const config = /** @type {shaka.extern.PlayerConfiguration} */(
{drm: {}, manifest: {dash: {}}});
{drm: {advanced: {}}, manifest: {dash: {}}});
if (this.licenseServers.size) {
config.drm.servers = {};
this.licenseServers.forEach((value, key) => {
config.drm.servers[key] = value;
});
}

if (this.clearKeys.size) {
config.drm.clearKeys = {};
this.clearKeys.forEach((value, key) => {
Expand Down
4 changes: 4 additions & 0 deletions demo/common/assets.js
Expand Up @@ -1043,6 +1043,8 @@ shakaAssets.testAssets = [
.addFeature(shakaAssets.Feature.HIGH_DEFINITION)
.addLicenseServer('com.microsoft.playready', 'https://content.uplynk.com/pr')
.addLicenseServer('com.widevine.alpha', 'https://content.uplynk.com/wv')
.setExtraConfig({drm: {advanced: {
'com.microsoft.playready': {sessionType: 'persistent-license'}}}})
.setRequestFilter(shakaAssets.UplynkRequestFilter)
.setResponseFilter(shakaAssets.UplynkResponseFilter),
// Reliable Playready playback requires Edge 16+
Expand All @@ -1060,6 +1062,8 @@ shakaAssets.testAssets = [
.addFeature(shakaAssets.Feature.HIGH_DEFINITION)
.addLicenseServer('com.microsoft.playready', 'https://content.uplynk.com/pr')
.addLicenseServer('com.widevine.alpha', 'https://content.uplynk.com/wv')
.setExtraConfig({drm: {advanced: {
'com.microsoft.playready': {sessionType: 'persistent-license'}}}})
.setRequestFilter(shakaAssets.UplynkRequestFilter)
.setResponseFilter(shakaAssets.UplynkResponseFilter),
new ShakaDemoAssetInfo(
Expand Down
1 change: 1 addition & 0 deletions demo/main.js
Expand Up @@ -1726,6 +1726,7 @@ shakaDemo.Main = class {
persistentStateRequired: false,
videoRobustness: '',
audioRobustness: '',
sessionType: '',
serverCertificate: new Uint8Array(0),
individualizationServer: '',
};
Expand Down
27 changes: 23 additions & 4 deletions docs/tutorials/drm-config.md
Expand Up @@ -145,18 +145,37 @@ playback. Passing in a higher security level than can be supported will cause
default is the empty string, which is the lowest security level supported by the
key system.

Each key system has their own values for robustness. The values for Widevine
are well-known (see the [Chromium sources][]) and listed below, but
values for other key systems are not known to us at this time.
Each key system has their own values for robustness.

[Chromium sources]: https://cs.chromium.org/chromium/src/components/cdm/renderer/widevine_key_system_properties.h?q=SW_SECURE_CRYPTO&l=22
##### Widevine

Chromium sources: https://cs.chromium.org/chromium/src/components/cdm/renderer/widevine_key_system_properties.h?q=SW_SECURE_CRYPTO&l=22

- `SW_SECURE_CRYPTO`
- `SW_SECURE_DECODE`
- `HW_SECURE_CRYPTO`
- `HW_SECURE_DECODE`
- `HW_SECURE_ALL`

##### PlayReady
theodab marked this conversation as resolved.
Show resolved Hide resolved

Microsoft Documentation: https://docs.microsoft.com/en-us/playready/overview/security-level

- `3000`
- `2000`

`com.microsoft.playready` key system ignores given robustness and stays at a
`2000` decryption level.

On Edge, Shaka will firstly try to request a MediaKeyAccess with the
recommendation keySystem `com.microsoft.playready.recommendation` and in case
it fails, silently fallback to `com.microsoft.playready`.

NB: Audio Hardware DRM is not supported (PlayReady limitation)

##### Other key-systems

Values for other key systems are not known to us at this time.

#### Continue the Tutorials

Expand Down
4 changes: 4 additions & 0 deletions externs/shaka/manifest.js
Expand Up @@ -111,6 +111,7 @@ shaka.extern.InitDataOverride;
* audioRobustness: string,
* videoRobustness: string,
* serverCertificate: Uint8Array,
* sessionTypes: Array.<string>,
joeyparrish marked this conversation as resolved.
Show resolved Hide resolved
* initData: Array.<!shaka.extern.InitDataOverride>,
* keyIds: Set.<string>
* }}
Expand All @@ -132,6 +133,9 @@ shaka.extern.InitDataOverride;
* <i>Defaults to false. Can be filled in by advanced DRM config.</i> <br>
* True if the application requires the key system to support persistent
* state, e.g., for persistent license storage.
* @property {Array.<string>} sessionTypes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be a single string, since you only ever use sessionTypes[0] in DrmEngine?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to keep the same field names as the MediaKeySystemAccess configuration, to keep consistency between the DRMEngine configuration, the given configuration to navigator APIs and the one we receive from them.

Is that okay for you ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entire array is passed to requestMediaKeySystemAccess, but only using sessionTypes[0] still seems like an issue to me. EME says that all session types in the array are considered required in the query. But what is the purpose of the second and subsequent members of the array if we ignore them?

Having an array implies that we will use all the values somehow. I don't want to field bug reports later that say things like "I asked for temporary & persistent, but only got temporary sessions! I wanted you to read my mind and do temporary for these keys and persistent for those keys." And if we later decide that this was a mistake, and we should represent the config as a single value (since that's all we can use), we would have to go to Shaka v4 before we could drop the more confusing version of the config.

The API shape of Shaka Player (including the config) should reflect what we will actually use, rather than exactly how we will pass the values to an underlying browser API.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your point makes total sense, I'll change it

* <i>Defaults to ['temporary'] if Shaka wasn't initiated for storage.
* Can be filled in by advanced DRM config sessionType parameter.</i> <br>
* @property {string} audioRobustness
* <i>Defaults to '', e.g., no specific robustness required. Can be filled in
* by advanced DRM config.</i> <br>
Expand Down
7 changes: 6 additions & 1 deletion externs/shaka/player.js
Expand Up @@ -516,7 +516,8 @@ shaka.extern.EmsgInfo;
* videoRobustness: string,
* audioRobustness: string,
* serverCertificate: Uint8Array,
* individualizationServer: string
* individualizationServer: string,
* sessionType: string
* }}
*
* @property {boolean} distinctiveIdentifierRequired
Expand Down Expand Up @@ -547,6 +548,10 @@ shaka.extern.EmsgInfo;
* @property {string} individualizationServer
* The server that handles an <code>'individualiation-request'</code>. If the
* server isn't given, it will default to the license server.
* @property {string} sessionType
* <i>Defaults to <code>'temporary'</code> for streaming.</i> <br>
* The MediaKey session type to create streaming licenses with. This doesn't
* affect offline storage.
*
* @exportDoc
*/
Expand Down