ImageDecoder

The ImageDecoder interface of the WebCodecs API provides a way to unpack and decode encoded image data. Available only in secure contexts.

MDN Reference

Constructors

Link copied to clipboard
constructor(init: ImageDecoderInit)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
external val complete: Boolean

The complete read-only property of the ImageDecoder interface returns true if encoded data has completed buffering.

Link copied to clipboard
external val completed: Promise<Void>

The completed read-only property of the ImageDecoder interface returns a promise that resolves once encoded data has finished buffering.

Link copied to clipboard
external val tracks: ImageTrackList

The tracks read-only property of the ImageDecoder interface returns a list of the tracks in the encoded image data.

Link copied to clipboard
external val type: String

The type read-only property of the ImageDecoder interface reflects the MIME type configured during construction.

Functions

Link copied to clipboard
open external override fun close()

The close() method of the ImageDecoder interface ends all pending work and releases system resources.

Link copied to clipboard
inline suspend fun ImageDecoder.decode(): ImageDecodeResult

The decode() method of the ImageDecoder interface enqueues a control message to decode the frame of an image.

Link copied to clipboard
external fun decodeAsync(options: ImageDecodeOptions = definedExternally): Promise<ImageDecodeResult>

The decode() method of the ImageDecoder interface enqueues a control message to decode the frame of an image.

Link copied to clipboard
external fun reset()

The reset() method of the ImageDecoder interface aborts all pending decode() operations; rejecting all pending promises. All other state will be unchanged. Class methods can continue to be invoked after reset(). E.g., calling decode() after reset() is permitted.