Constructor
new CmcdManager(playerInterface, config)
A CmcdManager maintains CMCD state as well as a collection of utility functions.
Parameters:
| Name | Type | Description | 
|---|---|---|
playerInterface | 
            
            shaka.util.CmcdManager.PlayerInterface | |
config | 
            
            shaka.extern.CmcdConfiguration | 
- Source:
 
Members
ObjectType :string
Type:
- string
 
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:
 
StreamingFormat :string
Type:
- string
 
Properties:
| Name | Value | Type | Description | 
|---|---|---|---|
DASH | 
            
            
                d | string | |
LOW_LATENCY_DASH | 
            
            
                ld | string | |
HLS | 
            
            
                h | string | |
LOW_LATENCY_HLS | 
            
            
                lh | string | |
SMOOTH | 
            
            
                s | string | |
OTHER | 
            
            
                o | string | 
- Source:
 
StreamType :string
Type:
- string
 
Properties:
| Name | Value | Type | Description | 
|---|---|---|---|
VOD | 
            
            
                v | string | |
LIVE | 
            
            
                l | string | 
- Source:
 
Version :number
Type:
- number
 
Properties:
| Name | Value | Type | Description | 
|---|---|---|---|
VERSION_1 | 
            
            
                1 | number | |
VERSION_2 | 
            
            
                2 | number | 
- Source:
 
playbackPlayingTime_ :number|undefined
Type:
- number | undefined
 
- Source:
 
playbackPlayTime_ :number|undefined
Type:
- number | undefined
 
- Source:
 
sf_ :shaka.util.CmcdManager.StreamingFormat|undefined
    Streaming format
    Type:
- shaka.util.CmcdManager.StreamingFormat | undefined
 
- 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
 
toHeaders(data) → {Object}
    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
 
applyManifestData(requestnon-null, context)
    Apply CMCD data to a manifest request.
    Parameters:
| Name | Type | Description | 
|---|---|---|
request | 
            
            shaka.extern.Request | The request to apply CMCD data to | 
context | 
            
            shaka.extern.RequestContext | The request context | 
- Source:
 
applyRequest_(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:
 
applyRequestData(typenon-null, requestnon-null, contextopt)
    Apply CMCD data to a request.
    Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
type | 
            
            shaka.net.NetworkingEngine.RequestType | The request type | |
request | 
            
            shaka.extern.Request | The request to apply CMCD data to | |
context | 
            
            shaka.extern.RequestContext | 
                
                    <optional> | 
            
            
            The request context | 
- Source:
 
applyRequestSegmentData(requestnon-null, context)
    Apply CMCD data to a segment request
    Parameters:
| Name | Type | Description | 
|---|---|---|
request | 
            
            shaka.extern.Request | |
context | 
            
            shaka.extern.RequestContext | The request context | 
- Source:
 
applyTextData(requestnon-null)
    Apply CMCD data to a text request
    Parameters:
| Name | Type | Description | 
|---|---|---|
request | 
            
            shaka.extern.Request | 
- Source:
 
calculateMSD_() → {number|undefined}
    Calculate measured start delay
- Source:
 
Returns:
- Type
 - number | undefined
 
calculateRtp_(stream, segment) → {number}
    Calculate requested maximum throughput
    Parameters:
| Name | Type | Description | 
|---|---|---|
stream | 
            
            shaka.extern.Stream | |
segment | 
            
            shaka.media.SegmentReference | 
- Source:
 
Returns:
- Type
 - number
 
configure(config)
    Called by the Player to provide an updated configuration any time it
changes.
    Parameters:
| Name | Type | Description | 
|---|---|---|
config | 
            
            shaka.extern.CmcdConfiguration | 
- 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
 
getDataForSegment_(context, requestUrinullable) → {CmcdData}
    Get CMCD data for a segment.
    Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
context | 
            
            shaka.extern.RequestContext | The request context | |
requestUri | 
            
            string | 
                
                
                    <nullable> | 
            
            
            
- Source:
 
Returns:
- Type
 - CmcdData
 
getObjectType_(context) → {shaka.util.CmcdManager.ObjectType|undefined}
    The CMCD object type.
    Parameters:
| Name | Type | Description | 
|---|---|---|
context | 
            
            shaka.extern.RequestContext | The request context | 
- Source:
 
Returns:
- Type
 - shaka.util.CmcdManager.ObjectType | undefined
 
getObjectTypeFromMimeType_(mimeTypenon-null) → {shaka.util.CmcdManager.ObjectType|undefined}
    The CMCD object type from mimeType.
    Parameters:
| Name | Type | Description | 
|---|---|---|
mimeType | 
            
            string | 
- Source:
 
Returns:
- Type
 - shaka.util.CmcdManager.ObjectType | undefined
 
getRemainingBufferLength_(type) → {number}
    Get the remaining buffer length for a media type in milliseconds
    Parameters:
| Name | Type | Description | 
|---|---|---|
type | 
            
            string | 
- Source:
 
Returns:
- Type
 - number
 
getStreamFormat_(type) → {shaka.util.CmcdManager.StreamingFormat|undefined}
    Get the stream format
    Parameters:
| Name | Type | Description | 
|---|---|---|
type | 
            
            shaka.net.NetworkingEngine.AdvancedRequestType | The request's advanced type | 
- Source:
 
Returns:
- Type
 - shaka.util.CmcdManager.StreamingFormat | undefined
 
getTopBandwidth_(type) → {number}
    Get the highest bandwidth for a given type.
    Parameters:
| Name | Type | Description | 
|---|---|---|
type | 
            
            shaka.util.CmcdManager.ObjectType | undefined | 
- Source:
 
Returns:
- Type
 - number
 
onPlaybackPlay_()
    Set playbackPlayTime_ when the play event is triggered
- Source:
 
setBuffering(buffering)
    Set the buffering state
    Parameters:
| Name | Type | Description | 
|---|---|---|
buffering | 
            
            boolean | 
- Source:
 
setLowLatency(lowLatency)
    Set the low latency
    Parameters:
| Name | Type | Description | 
|---|---|---|
lowLatency | 
            
            boolean | 
- Source:
 
setMediaElement(mediaElement)
    Set media element and setup event listeners
    Parameters:
| Name | Type | Description | 
|---|---|---|
mediaElement | 
            
            HTMLMediaElement | The video element | 
- Source:
 
setStartTimeOfLoad(startTimeOfLoad)
    Set start time of load if autoplay is enabled
    Parameters:
| Name | Type | Description | 
|---|---|---|
startTimeOfLoad | 
            
            number | 
- Source:
 
setupMSDEventListeners_()
    Setup event listeners for msd calculation
- 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, getLiveLatency: function(): number}
 
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. | 
getLiveLatency | 
            
            
            function | Get latency in milliseconds between the live edge and what's currently playing. | 
- Source: