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}
Members
Methods
boot()
Boots the worker if running in a Worker global scope.
This is called at load time so the worker is ready immediately.
errorToObject_(e) → {Object}
Converts a caught error into a plain serializable object for postMessage.
Parameters:
| Name | Type | Description |
|---|---|---|
e |
* |
Returns:
- Type
- Object
onDestroy_(msgnon-null)
Destroys a transmuxer instance.
Parameters:
| Name | Type | Description |
|---|---|---|
msg |
Object |
onInit_(msgnon-null)
Creates a transmuxer instance.
Parameters:
| Name | Type | Description |
|---|---|---|
msg |
Object |
onMessage_(eventnon-null)
Handles incoming messages from the main thread.
Parameters:
| Name | Type | Description |
|---|---|---|
event |
MessageEvent |
onTransmux_(msgnon-null)
Runs a transmux operation and posts back the result.
Parameters:
| Name | Type | Description |
|---|---|---|
msg |
Object |
start()
Starts listening for messages. Call this from the worker global scope.