Home Reference Source
import CMCDController from 'hls.js/src/controller/cmcd-controller.ts'
public class | source

CMCDController

Controller to deal with Common Media Client Data (CMCD)

Static Method Summary

Static Public Methods
public static

Append query args to a uri.

public static

serialize(data: CMCD): string

Serialize a CMCD data object according to the rules defined in the section 3.2 of CTA-5004.

public static

toHeaders(data: CMCD): Partial

Convert a CMCD data object to request headers according to the rules defined in the section 2.1 and 3.2 of CTA-5004.

public static

toQuery(data: CMCD): 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.

public static

Generate a random v4 UUI

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

Apply CMCD data to a segment request

public

Apply CMCD data to a manifest request.

public

audioBuffer: SourceBuffer

public
public
public

config: HlsConfig

public

hls: Hls

public
public

media: HTMLMediaElement

public
public
public
public
public
public

videoBuffer: SourceBuffer

Method Summary

Public Methods
public

apply(context: LoaderContext, data: CMCD)

Apply CMCD data to a request.

public

createData(): CMCD

Create baseline CMCD data

public

Create a playlist loader

public

Create a playlist loader

public
public

getBufferLength(type: CMCDObjectType): *

Get the buffer length for a media type in milliseconds

public

getObjectType(fragment: Fragment): *

The CMCD object type.

public

getTopBandwidth(type: CMCDObjectType): *

Get the highest bitrate.

public

onBufferCreated(event: undefined, data: BufferCreatedData)

public

onMediaAttached(event: undefined, data: MediaAttachedData)

public
public
public

Static Public Methods

public static appendQueryToUri(uri: undefined, query: undefined): string source

Append query args to a uri.

Params:

NameTypeAttributeDescription
uri undefined
query undefined

Return:

string

public static serialize(data: CMCD): string source

Serialize a CMCD data object according to the rules defined in the section 3.2 of CTA-5004.

Params:

NameTypeAttributeDescription
data CMCD

Return:

string

public static toHeaders(data: CMCD): Partial source

Convert a CMCD data object to request headers according to the rules defined in the section 2.1 and 3.2 of CTA-5004.

Params:

NameTypeAttributeDescription
data CMCD

Return:

Partial

public static toQuery(data: CMCD): string source

Convert a CMCD data object to query args according to the rules defined in the section 2.2 and 3.2 of CTA-5004.

Params:

NameTypeAttributeDescription
data CMCD

Return:

string

public static uuid(): string source

Generate a random v4 UUI

Return:

string

Public Constructors

public constructor() source

Public Members

public applyFragmentData: * source

Apply CMCD data to a segment request

public applyPlaylistData: * source

Apply CMCD data to a manifest request.

public audioBuffer: SourceBuffer source

public buffering: boolean source

public cid: string source

public config: HlsConfig source

public hls: Hls source

public initialized: boolean source

public media: HTMLMediaElement source

public onPlaying: * source

public onWaiting: * source

public sid: string source

public starved: boolean source

public useHeaders: boolean source

public videoBuffer: SourceBuffer source

Public Methods

public apply(context: LoaderContext, data: CMCD) source

Apply CMCD data to a request.

Params:

NameTypeAttributeDescription
context LoaderContext
data CMCD

public createData(): CMCD source

Create baseline CMCD data

Return:

CMCD

public createFragmentLoader(): * source

Create a playlist loader

Return:

*

public createPlaylistLoader(): * source

Create a playlist loader

Return:

*

public destroy() source

public getBufferLength(type: CMCDObjectType): * source

Get the buffer length for a media type in milliseconds

Params:

NameTypeAttributeDescription
type CMCDObjectType

Return:

*

public getObjectType(fragment: Fragment): * source

The CMCD object type.

Params:

NameTypeAttributeDescription
fragment Fragment

Return:

*

public getTopBandwidth(type: CMCDObjectType): * source

Get the highest bitrate.

Params:

NameTypeAttributeDescription
type CMCDObjectType

Return:

*

public onBufferCreated(event: undefined, data: BufferCreatedData) source

Params:

NameTypeAttributeDescription
event undefined
data BufferCreatedData

public onMediaAttached(event: undefined, data: MediaAttachedData) source

Params:

NameTypeAttributeDescription
event undefined
data MediaAttachedData

public onMediaDetached() source

public registerListeners() source

public unregisterListeners() source