Class: shaka.media.ContentWorkarounds

A collection of methods to work around content issues on various platforms.

Constructor

new ContentWorkarounds()

A collection of methods to work around content issues on various platforms.

Source:

Members

BOX_SIZE_64_OFFSET_ :number

Offset to a box's 64-bit size field, if it has one.
Type:
  • number
Source:

BOX_SIZE_OFFSET_ :number

Offset to a box's size field.
Type:
  • number
Source:

BOX_TYPE_ENCA_ :number

Box type for "enca".
Type:
  • number
Source:

BOX_TYPE_ENCV_ :number

Box type for "encv".
Type:
  • number
Source:

BOX_TYPE_OFFSET_ :number

Offset to a box's type field.
Type:
  • number
Source:

CANNED_SINF_BOX_ :shaka.util.Lazy.<!Uint8Array>

A canned "sinf" box for use when adding fake encryption metadata to init segments.
Type:
Source:
See:

CANNED_SINF_BOX_FORMAT_OFFSET_ :number

The location of the format field in the "frma" box inside the canned "sinf" box above.
Type:
  • number
Source:

Methods

createEncryptionMetadata_(initSegmentnon-null, sourceBox, metadataBoxType) → {Uint8Array}

Create an encryption metadata box ("encv" or "enca" box), based on the source box ("mp4a", "avc1", etc). Returns a new buffer containing the encryption metadata box.
Parameters:
Name Type Description
initSegment Uint8Array
sourceBox shaka.extern.ParsedBox
metadataBoxType number
Source:
Returns:
Type
Uint8Array

fakeEncryption(initSegmentBuffernon-null, urinullable) → {Uint8Array}

Transform the init segment into a new init segment buffer that indicates encryption. If the init segment already indicates encryption, return the original init segment. Should only be called for MP4 init segments, and only on platforms that need this workaround.
Parameters:
Name Type Attributes Description
initSegmentBuffer BufferSource
uri string <nullable>
Source:
See:
Returns:
Type
Uint8Array

insertEncryptionMetadata_(initSegmentnon-null, stsdBox, sourceBox, ancestorBoxesnon-null, metadataBoxType) → {Uint8Array}

Insert an encryption metadata box ("encv" or "enca" box) into the MP4 init segment, based on the source box ("mp4a", "avc1", etc). Returns a new buffer containing the modified init segment.
Parameters:
Name Type Description
initSegment Uint8Array
stsdBox shaka.extern.ParsedBox
sourceBox shaka.extern.ParsedBox
ancestorBoxes Array.<shaka.extern.ParsedBox>
metadataBoxType number
Source:
Returns:
Type
Uint8Array

updateBoxSize_(dataArraynon-null, boxStart, newBoxSize)

Modify an MP4 box's size field in-place.
Parameters:
Name Type Description
dataArray Uint8Array
boxStart number The start position of the box in dataArray.
newBoxSize number The new size of the box.
Source: