Class: shaka.transmuxer.TransmuxerWorker

Web Worker entry point for offloading transmux operations. This class manages transmuxer instances inside a Web Worker and communicates with the main thread via postMessage. Message protocol (main -> worker): {cmd: 'init', id: number, mimeType: string} {cmd: 'transmux', id: number, reqId: number, data: ArrayBuffer, streamProps: Object, refProps: Object, duration: number, contentType: string} {cmd: 'destroy', id: number} Response protocol (worker -> main): {cmd: 'transmuxed', id: number, reqId: number, output: Object, streamMutations: Object} {cmd: 'error', id: number, reqId: number, error: Object} {cmd: 'destroyed', id: number}

Constructor

new TransmuxerWorker()

Web Worker entry point for offloading transmux operations. This class manages transmuxer instances inside a Web Worker and communicates with the main thread via postMessage. Message protocol (main -> worker): {cmd: 'init', id: number, mimeType: string} {cmd: 'transmux', id: number, reqId: number, data: ArrayBuffer, streamProps: Object, refProps: Object, duration: number, contentType: string} {cmd: 'destroy', id: number} Response protocol (worker -> main): {cmd: 'transmuxed', id: number, reqId: number, output: Object, streamMutations: Object} {cmd: 'error', id: number, reqId: number, error: Object} {cmd: 'destroyed', id: number}

Source:

Members

transmuxers_ :Map<number, !shaka.extern.Transmuxer>

Type:
Source:

Methods

boot()

Boots the worker if running in a Worker global scope. This is called at load time so the worker is ready immediately.
Source:

errorToObject_(e) → {Object}

Converts a caught error into a plain serializable object for postMessage.
Parameters:
Name Type Description
e *
Source:
Returns:
Type
Object

onDestroy_(msgnon-null)

Destroys a transmuxer instance.
Parameters:
Name Type Description
msg Object
Source:

onInit_(msgnon-null)

Creates a transmuxer instance.
Parameters:
Name Type Description
msg Object
Source:

onMessage_(eventnon-null)

Handles incoming messages from the main thread.
Parameters:
Name Type Description
event MessageEvent
Source:

onTransmux_(msgnon-null)

Runs a transmux operation and posts back the result.
Parameters:
Name Type Description
msg Object
Source:

start()

Starts listening for messages. Call this from the worker global scope.
Source: