PIXI.BasisLoader.TranscoderWorker
class TranscoderWorker
Worker class for transcoding *.basis files in background threads.
To enable asynchronous transcoding, you need to provide the URL to the basis_universal transcoding library.
Summary
Properties from TranscoderWorker
| string |
URL for the script containing the basis_universal library. |
|
a promise that when reslved means the transcoder is ready to be used |
|
| string |
Generated URL for the transcoder worker script. |
|
|
Methods from TranscoderWorker
| Promise<[void, void]> |
|
| void |
|
| Promise<void> |
|
| Promise<ITranscodeResponse> |
|
Public Properties
static bindingURL: string
URL for the script containing the basis_universal library.
static onTranscoderInitialized
a promise that when reslved means the transcoder is ready to be used
static workerURL: string
Generated URL for the transcoder worker script.
Protected Properties
protected onMessage
Handles responses from the web-worker
| Name | Type | Description |
|---|---|---|
| e |
a message event containing the transcoded response |
Public Methods
static loadTranscoder(jsURL: string, wasmURL: string) → {Promise<[void, void]>}
Loads the transcoder source code
| Name | Type | Description |
|---|---|---|
| jsURL | string |
URL to the javascript basis transcoder |
| wasmURL | string |
URL to the wasm basis transcoder |
| Type | Description |
|---|---|
| Promise<[void, void]> |
A promise that resolves when both the js and wasm transcoders have been loaded. |
static setTranscoder(jsSource: string, wasmSource: ArrayBuffer) → {void}
Set the transcoder source code directly
| Name | Type | Description |
|---|---|---|
| jsSource | string |
source for the javascript basis transcoder |
| wasmSource | ArrayBuffer |
source for the wasm basis transcoder |
| Type | Description |
|---|---|
| void |
initAsync() → {Promise<void>}
| Type | Description |
|---|---|
| Promise<void> |
a promise that is resolved when the web-worker is initialized |
transcodeAsync(basisData: Uint8Array, rgbaFormat: BASIS_FORMATS, rgbFormat: BASIS_FORMATS) → {Promise<ITranscodeResponse>}
Creates a promise that will resolve when the transcoding of a *.basis file is complete.
| Name | Type | Description |
|---|---|---|
| basisData | Uint8Array |
*.basis file contents |
| rgbaFormat | BASIS_FORMATS |
transcoding format for RGBA files |
| rgbFormat | BASIS_FORMATS |
transcoding format for RGB files |
| Type | Description |
|---|---|
| Promise<ITranscodeResponse> |
a promise that is resolved with the transcoding response of the web-worker |