Interfaces

TgfxVideo

A decoding video, driven by the platform player - AVPlayer on iOS, MediaPlayer on Android - so audio, looping and seeking cost this package no decoder of its own.

A frame never reaches JS at all, as pixels or as a pointer: the decoder writes into a registry entry natively and JS only ever sees its id.

Extends

  • HybridObject<{ android: "kotlin"; ios: "swift"; }>

Properties

currentTime

readonly currentTime: number;

Playback position in milliseconds.


duration

readonly duration: number;

Total length in milliseconds, 0 when the source does not report one.


framerate

readonly framerate: number;

height

readonly height: number;

looping

looping: boolean;

paused

paused: boolean;

rotation

readonly rotation: number;

Clockwise degrees the buffer must be rotated by to be upright.


volume

volume: number;

0 to 1.


width

readonly width: number;

Methods

release()

release(): void;

Stop playback and free the decoder and its buffers now, rather than at the next GC. A player left to a finalizer holds a hardware decoder - a device has a handful of those, so a screen that opens videos runs out.

Returns

void


seek()

seek(millis: number): void;

Parameters

millis

number

Returns

void


updateFrame()

updateFrame(): number;

Point this video's image at its newest decoded frame and return that image's registry id, or 0 when nothing new has been decoded since the last call.

The id is stable for the life of the video - a new frame replaces what the id points at, so a scene referencing it costs no re-commit - and the frame is whatever the decoder produced: a CVPixelBuffer on iOS, a SurfaceTexture stream on Android, neither of them copied.

Returns

number