Skip to main content

API Reference

All exports of @azzapp/react-native-skia-video. Guides: Video Player · Video Composition · Playback · Audio · Exporting · Android Capabilities.

Hooks & functions

ExportDescription
useVideoPlayer(options)Plays a single video; returns { currentFrame, player }.
useVideoCompositionPlayer(options)Plays a composition through a drawFrame worklet; returns { currentFrame, player }.
exportVideoComposition(options)Renders a composition to an H.264 file (AAC audio when present); returns a Promise<void>.
getDecodingCapabilitiesFor(mimetype)Android: decoder limits for a mime type.
getValidEncoderConfigurations(width, height, frameRate, bitRate)Android: closest supported encoder configurations.

VideoComposition

type VideoComposition = {
duration: number; // seconds
items: VideoCompositionItem[];
};

type VideoCompositionItem = VideoCompositionVideoItem | VideoCompositionAudioItem;

Common item fields

FieldTypeDescription
idstringUnique id; keys the frames map for video items.
pathstringLocal file path (no file:// scheme).
compositionStartTimenumberStart on the composition timeline, seconds.
startTimenumberOffset inside the source file, seconds.
durationnumberItem duration, seconds.

VideoCompositionVideoItem

FieldTypeDescription
kind'video' (default)Produces frames for drawFrame.
resolution{ width, height }?Decode at this resolution (downscaling improves performance).
audioboolean | { volume?: number }Also play/mix the file's audio track. Defaults to false.

VideoCompositionAudioItem

FieldTypeDescription
kind'audio'Sound only — never appears in frames. Source can be an audio or video file.
volumenumber?0–1, defaults to 1.

FrameDrawer

type FrameDrawer<T = undefined> = (args: {
context: T; // from beforeDrawFrame
canvas: SkCanvas;
videoComposition: VideoComposition;
currentTime: number; // seconds
frames: Record<string, VideoFrame>; // active video items only
width: number;
height: number;
}) => void;

VideoFrame

FieldTypeDescription
textureunknownNative GPU texture — wrap with Skia.Image.MakeImageFromNativeTextureUnstable(texture, width, height).
width / heightnumberFrame size in pixels, as stored.
rotationnumberDisplay rotation in degrees (0, 90, 180, 270).

VideoPlayer

Returned by useVideoPlayer (full interface; the hook's player exposes the playback subset).

MemberDescription
play() / pause()Control playback.
seekTo(seconds)Seek; emits seekComplete.
decodeNextFrame()UI-thread only: decode and return the next VideoFrame.
currentTime / durationSeconds, read-only.
isPlaying / isLoopingPlayback state.
volume / playbackSpeedAudio volume (0–1) and speed (1 = normal).
on(event, listener)ready, bufferingStart, bufferingEnd, bufferingUpdate, complete, seekComplete, playingStatusChange, error. Returns an unsubscribe function.
dispose()Release the player.

ExportOptions

FieldTypeDefaultDescription
outPathstringDestination file path.
width / heightnumberOutput resolution in pixels.
frameRatenumberFrames per second.
bitRatenumberVideo bit rate, bits per second.
encoderNamestring?autoAndroid: encoder to use (see getValidEncoderConfigurations).
audioBitRatenumber?128000AAC bit rate (compositions with audio).
audioSampleRatenumber?44100AAC sample rate.
audioChannelCountnumber?21 = mono, 2 = stereo.

exportVideoComposition additionally accepts drawFrame, beforeDrawFrame / afterDrawFrame, onProgress({ framesCompleted, nbFrames }) and abortSignal.