Class: shaka.util.CmcdManager
A CmcdManager maintains CMCD state as well as a collection of utility
functions.
Constructor
new CmcdManager(playerInterface, config)
A CmcdManager maintains CMCD state as well as a collection of utility
functions.
Parameters:
- Source:
Members
ObjectType :string
Type:
Properties:
Name |
Value |
Type |
Description |
MANIFEST |
m
|
string
|
|
AUDIO |
a
|
string
|
|
VIDEO |
v
|
string
|
|
MUXED |
av
|
string
|
|
INIT |
i
|
string
|
|
CAPTION |
c
|
string
|
|
TIMED_TEXT |
tt
|
string
|
|
KEY |
k
|
string
|
|
OTHER |
o
|
string
|
|
- Source:
Type:
Properties:
Name |
Value |
Type |
Description |
DASH |
d
|
string
|
|
HLS |
h
|
string
|
|
SMOOTH |
s
|
string
|
|
OTHER |
o
|
string
|
|
- Source:
StreamType :string
Type:
Properties:
Name |
Value |
Type |
Description |
VOD |
v
|
string
|
|
LIVE |
l
|
string
|
|
- Source:
Version :number
The CMCD spec version
Type:
- Source:
buffering_ :boolean
Type:
- Source:
playbackStarted_ :boolean
Type:
- Source:
Streaming format
Type:
- Source:
starved_ :boolean
Type:
- Source:
Methods
appendQueryToUri(uri, query) → {string}
Append query args to a uri.
Parameters:
Name |
Type |
Description |
uri |
string
|
|
query |
string
|
|
- Source:
Returns:
-
Type
-
string
serialize(data) → {string}
Serialize a CMCD data object according to the rules defined in the
section 3.2 of
[CTA-5004](https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5004-final.pdf).
Parameters:
Name |
Type |
Description |
data |
CmcdData
|
The CMCD data object |
- Source:
Returns:
-
Type
-
string
Convert a CMCD data object to request headers according to the rules
defined in the section 2.1 and 3.2 of
[CTA-5004](https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5004-final.pdf).
Parameters:
Name |
Type |
Description |
data |
CmcdData
|
The CMCD data object |
- Source:
Returns:
-
Type
-
Object
toQuery(data) → {string}
Convert a CMCD data object to query args according to the rules
defined in the section 2.2 and 3.2 of
[CTA-5004](https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5004-final.pdf).
Parameters:
Name |
Type |
Description |
data |
CmcdData
|
The CMCD data object |
- Source:
Returns:
-
Type
-
string
appendSrcData(uri, mimeType) → {string}
Apply CMCD data to streams loaded via src=.
Parameters:
Name |
Type |
Description |
uri |
string
|
|
mimeType |
string
|
|
- Source:
Returns:
-
Type
-
string
appendTextTrackData(uri) → {string}
Apply CMCD data to side car text track uri.
Parameters:
Name |
Type |
Description |
uri |
string
|
|
- Source:
Returns:
-
Type
-
string
apply_(requestnon-null, datanon-null, useHeaders)
Apply CMCD data to a request.
Parameters:
Name |
Type |
Description |
request |
shaka.extern.Request
|
The request to apply CMCD data to |
data |
CmcdData
|
The data object |
useHeaders |
boolean
|
Send data via request headers |
- Source:
applyData(typenon-null, requestnon-null, contextopt)
Apply CMCD data to a request.
Parameters:
- Source:
applyManifestData(requestnon-null, context)
Apply CMCD data to a manifest request.
Parameters:
- Source:
applySegmentData(requestnon-null, context)
Apply CMCD data to a segment request
Parameters:
- Source:
applyTextData(requestnon-null)
Apply CMCD data to a text request
Parameters:
- Source:
calculateRtp_(stream, segment) → {number}
Calculate requested maximun throughput
Parameters:
- Source:
Returns:
-
Type
-
number
Called by the Player to provide an updated configuration any time it
changes.
Parameters:
- Source:
createData_() → {CmcdData}
Create baseline CMCD data
- Source:
Returns:
-
Type
-
CmcdData
filterKeys_(data) → {CmcdData}
Filter the CMCD data object to include only the keys specified in the
configuration.
Parameters:
Name |
Type |
Description |
data |
CmcdData
|
|
- Source:
Returns:
-
Type
-
CmcdData
getBufferLength_(type) → {number}
Get the buffer length for a media type in milliseconds
Parameters:
Name |
Type |
Description |
type |
string
|
|
- Source:
Returns:
-
Type
-
number
getObjectType_(context)
The CMCD object type.
Parameters:
- Source:
getRemainingBufferLength_(type) → {number}
Get the remaining buffer length for a media type in milliseconds
Parameters:
Name |
Type |
Description |
type |
string
|
|
- Source:
Returns:
-
Type
-
number
getTopBandwidth_(type) → {number}
Get the highest bandwidth for a given type.
Parameters:
Name |
Type |
Description |
type |
string
|
|
- Source:
Returns:
-
Type
-
number
reset()
Resets the CmcdManager.
- Source:
setBuffering(buffering)
Set the buffering state
Parameters:
Name |
Type |
Description |
buffering |
boolean
|
|
- Source:
urlToRelativePath_(url, base) → {string}
Constructs a relative path from a URL
Parameters:
Name |
Type |
Description |
url |
string
|
|
base |
string
|
|
- Source:
Returns:
-
Type
-
string
Type Definitions
PlayerInterface
Type:
-
{getBandwidthEstimate: function(): number, getBufferedInfo: function(): shaka.extern.BufferedInfo, getCurrentTime: function(): number, getPlaybackRate: function(): number, getVariantTracks: function(): Array.<shaka.extern.Track>, isLive: function(): boolean}
Properties:
Name |
Type |
Description |
getBandwidthEstimate |
function
|
Get the estimated bandwidth in bits per second. |
getBufferedInfo |
function
|
Get information about what the player has buffered. |
getCurrentTime |
function
|
Get the current time |
getPlaybackRate |
function
|
Get the playback rate |
getVariantTracks |
function
|
Get the variant tracks |
isLive |
function
|
Get if the player is playing live content. |
- Source: