start

suspend fun start(canvas: JsAny?, workerUrl: String = "./kiteplayer-web-worker.mjs", codecUrl: String = "./kite.mjs", libassUrl: String? = "./kiteass.mjs"): KitePlayerWorker

Keeps the original startup entry point with display wake enabled.


suspend fun start(canvas: JsAny?, workerUrl: String = "./kiteplayer-web-worker.mjs", codecUrl: String = "./kite.mjs", libassUrl: String? = "./kiteass.mjs", keepDisplayAwake: Boolean = true): KitePlayerWorker

Starts a worker player, hands it canvas and the page's audio, and returns once it can play.

Parameters

canvas

the HTMLCanvasElement to draw on, or null for sound only. Its drawing passes to the worker for good, so the page cannot draw on it afterwards.

workerUrl

the worker binary, kiteplayer-web-worker.mjs, as the page serves it.

codecUrl

the codec module, kite.mjs. A relative address is read against the page's, as workerUrl is.

libassUrl

the libass module, kiteass.mjs, which draws ASS subtitles as their authors styled them. A relative address is read against the page's. The worker starts loading it at once and does not wait for it: an ASS track that opens first is kept until it lands. Without the module, ASS draws with the built-in styling. Null loads nothing now, and the first ASS track then looks beside the worker binary.

keepDisplayAwake

whether the page's screen stays awake while the worker plays a picture on canvas (#238), which a canvas does not get from the browser by itself.

Throws

with PlaybackError.Internal when the worker cannot load, or cannot load the codec module.