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.


PIXI.BasisLoader.TranscoderWorker.bindingURL string static

URL for the script containing the basis_universal library.

PIXI.BasisLoader.TranscoderWorker.workerURL string static

Generated URL for the transcoder worker script.

onMessage protected

Handles responses from the web-worker


PIXI.BasisLoader.TranscoderWorker.loadTranscoder (jsURL, wasmURL) Promise<[void, void]> static

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.

PIXI.BasisLoader.TranscoderWorker.setTranscoder (jsSource, wasmSource) void static

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

initAsync () Promise<void>

Type Description
Promise<void> a promise that is resolved when the web-worker is initialized

transcodeAsync (basisData, rgbaFormat, rgbFormat) 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


transcoding format for RGBA files


transcoding format for RGB files

Type Description
Promise<ITranscodeResponse> a promise that is resolved with the transcoding response of the web-worker