Constructor
new ContentProtection()
A set of functions for parsing and interpreting ContentProtection elements.
- Source:
Members
licenseUrlParsers_ :Map.<string, function(shaka.dash.ContentProtection.Element)>
A map of key system name to license server url parser.
Type:
- Map.<string, function(shaka.dash.ContentProtection.Element)>
- Source:
PLAYREADY_RECORD_TYPES :number
Enum for PlayReady record types.
Type:
- number
Properties:
Name | Value | Type | Description |
---|---|---|---|
RIGHTS_MANAGEMENT |
1 | number | |
RESERVED |
2 | number | |
EMBEDDED_LICENSE |
3 | number |
- Source:
Methods
convertElements_(defaultInit, elementsnon-null, keySystemsByURInon-null, keyIdsnon-null) → {Array.<shaka.extern.DrmInfo>}
Creates DrmInfo objects from the given element.
Parameters:
Name | Type | Description |
---|---|---|
defaultInit |
Array.<shaka.extern.InitDataOverride> | |
elements |
Array.<shaka.dash.ContentProtection.Element> | |
keySystemsByURI |
Object.<string, string> | |
keyIds |
Set.<string> |
- Source:
Returns:
- Type
- Array.<shaka.extern.DrmInfo>
getClearKeyLicenseUrl(element) → {string}
Gets a ClearKey license URL from a content protection element
containing a custom `clearkey::Laurl` element
Parameters:
Name | Type | Description |
---|---|---|
element |
shaka.dash.ContentProtection.Element |
- Source:
Returns:
- Type
- string
getInitDataClearKey_(element, keyIdsnon-null) → {Array.<shaka.extern.InitDataOverride>}
Creates ClearKey initData from Default_KID value retrieved from previously
parsed ContentProtection tag.
Parameters:
Name | Type | Description |
---|---|---|
element |
shaka.dash.ContentProtection.Element | |
keyIds |
Set.<string> |
- Source:
Returns:
- Type
- Array.<shaka.extern.InitDataOverride>
getInitDataFromPro_(element) → {Array.<shaka.extern.InitDataOverride>}
Gets a PlayReady initData from a content protection element
containing a PlayReady Pro Object
Parameters:
Name | Type | Description |
---|---|---|
element |
shaka.dash.ContentProtection.Element |
- Source:
Returns:
- Type
- Array.<shaka.extern.InitDataOverride>
getLaurl_(xmlnon-null) → {string}
PlayReady Header format: https://goo.gl/dBzxNA
Parameters:
Name | Type | Description |
---|---|---|
xml |
Element |
- Source:
Returns:
- Type
- string
getPlayReadyLicenseUrl(element) → {string}
Gets a PlayReady license URL from a content protection element
containing a PlayReady Header Object
Parameters:
Name | Type | Description |
---|---|---|
element |
shaka.dash.ContentProtection.Element |
- Source:
Returns:
- Type
- string
getWidevineLicenseUrl(element) → {string}
Gets a Widevine license URL from a content protection element
containing a custom `ms:laurl` element
Parameters:
Name | Type | Description |
---|---|---|
element |
shaka.dash.ContentProtection.Element |
- Source:
Returns:
- Type
- string
parseElement_(elemnon-null) → {shaka.dash.ContentProtection.Element}
Parses the given ContentProtection element.
Parameters:
Name | Type | Description |
---|---|---|
elem |
Element |
- Source:
Returns:
parseElements_(elemsnon-null) → {Array.<shaka.dash.ContentProtection.Element>}
Parses the given ContentProtection elements. If there is an error, it
removes those elements.
Parameters:
Name | Type | Description |
---|---|---|
elems |
Array.<!Element> |
- Source:
Returns:
- Type
- Array.<shaka.dash.ContentProtection.Element>
parseFromAdaptationSet(elemsnon-null, ignoreDrmInfo, keySystemsByURInon-null) → {shaka.dash.ContentProtection.Context}
Parses info from the ContentProtection elements at the AdaptationSet level.
Parameters:
Name | Type | Description |
---|---|---|
elems |
Array.<!Element> | |
ignoreDrmInfo |
boolean | |
keySystemsByURI |
Object.<string, string> |
- Source:
Returns:
parseFromRepresentation(elemsnon-null, context, ignoreDrmInfo, keySystemsByURInon-null) → {string}
Parses the given ContentProtection elements found at the Representation
level. This may update the |context|.
Parameters:
Name | Type | Description |
---|---|---|
elems |
Array.<!Element> | |
context |
shaka.dash.ContentProtection.Context | |
ignoreDrmInfo |
boolean | |
keySystemsByURI |
Object.<string, string> |
- Source:
Returns:
The parsed key ID
- Type
- string
parseMsPro_(data) → {Array.<shaka.dash.ContentProtection.PlayReadyRecord>}
Parses a buffer for PlayReady Objects. The data
should contain a 32-bit integer indicating the length of
the PRO in bytes. Following that, a 16-bit integer for
the number of PlayReady Object Records in the PRO. Lastly,
a byte array of the PRO Records themselves.
PlayReady Object format: https://goo.gl/W8yAN4
Parameters:
Name | Type | Description |
---|---|---|
data |
BufferSource |
- Source:
Returns:
- Type
- Array.<shaka.dash.ContentProtection.PlayReadyRecord>
parseMsProRecords_(viewnon-null, byteOffset) → {Array.<shaka.dash.ContentProtection.PlayReadyRecord>}
Parses an Array buffer starting at byteOffset for PlayReady Object Records.
Each PRO Record is preceded by its PlayReady Record type and length in
bytes.
PlayReady Object Record format: https://goo.gl/FTcu46
Parameters:
Name | Type | Description |
---|---|---|
view |
DataView | |
byteOffset |
number |
- Source:
Returns:
- Type
- Array.<shaka.dash.ContentProtection.PlayReadyRecord>
Type Definitions
Context
Contains information about the ContentProtection elements found at the
AdaptationSet level.
Type:
- {defaultKeyId: ?string, defaultInit: Array.<shaka.extern.InitDataOverride>, drmInfos: !Array.<shaka.extern.DrmInfo>, firstRepresentation: boolean}
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
defaultKeyId |
string |
<nullable> |
The default key ID to use. This is used by parseKeyIds as a default. This can be null to indicate that there is no default. |
defaultInit |
Array.<shaka.extern.InitDataOverride> | The default init data override. This can be null to indicate that there is no default. | |
drmInfos |
Array.<shaka.extern.DrmInfo> | The DrmInfo objects. | |
firstRepresentation |
boolean | True when first parsed; changed to false after the first call to parseKeyIds. This is used to determine if a dummy key-system should be overwritten; namely that the first representation can replace the dummy from the AdaptationSet. |
- Source:
Element
The parsed result of a single ContentProtection element.
Type:
- {node: !Element, schemeUri: string, keyId: ?string, init: Array.<shaka.extern.InitDataOverride>}
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
node |
Element | The ContentProtection XML element. | |
schemeUri |
string | The scheme URI. | |
keyId |
string |
<nullable> |
The default key ID, if present. |
init |
Array.<shaka.extern.InitDataOverride> | The init data, if present. If there is no init data, it will be null. If this is non-null, there is at least one element. |
- Source:
PlayReadyRecord
The parsed result of a PlayReady object record.
Type:
- {type: number, value: !Uint8Array}
Properties:
Name | Type | Description |
---|---|---|
type |
number | Type of data stored in the record. |
value |
Uint8Array | Record content. |
- Source: