This library builds on the API of @azzapp/react-native-skia-video and its batical fork. Most composition and drawing concepts remain, while frame ownership and Skia texture interop change.
Follow the installation instructions with the exact tested Skia, WebGPU, Reanimated, and Worklets versions. Remove the old Skia and Skia Video packages from the application before installing their replacements. Two native modules with the old and new video implementations must not coexist.
Replace imports:
| Previous package | New package |
|---|---|
@shopify/react-native-skia |
react-native-skia |
@azzapp/react-native-skia-video or your fork's package name |
react-native-skia-webgpu-video |
Apply the required Skia patch in the consuming app, install pods on iOS, and rebuild native binaries. A JavaScript-only update cannot apply the native changes. See upstream notes before changing the pinned Skia version.
Replace the hook names in your imports and call sites. The old names are not exported as compatibility aliases:
| Previous hook | Required replacement |
|---|---|
useVideoCompositionPlayer |
useVideoComposition |
useVideoPlayer |
useVideoPlayback |
Use useVideoComposition for a timeline and useVideoPlayback for a single video. Their composition options, playback controls and return values retain the same shape; migrating the hook names and frame drawing is required.
A native Metal or OpenGL texture handle is not a Dawn texture. Replace calls to Skia.Image.MakeImageFromNativeTextureUnstable(frame.texture, ...) with the library helper:
import { drawVideoFrame } from 'react-native-skia-webgpu-video';
import type { FrameDrawer } from 'react-native-skia-webgpu-video';
const drawFrame: FrameDrawer = ({ canvas, frames, width, height }) => {
'worklet';
const frame = frames.clip;
if (frame) {
drawVideoFrame(canvas, frame, { x: 0, y: 0, width, height }, {
fit: 'contain',
});
}
};Use makeVideoFrameImage(frame) if you need the image for another Skia operation. The library owns the returned image: do not independently call dispose() on it, change its native descriptor, or keep using it after its producer releases it. Application-owned synthetic frames need their own explicit ownership and cleanup.
The hooks still expose familiar play, pause, seek, looping, and readiness/error events. Compositions use seconds. beforeDrawFrame and afterDrawFrame run per frame; they are not session initialization/finalization callbacks.
useVideoComposition renders a composition to a shared current image. Reuse the composition and drawFrame in exportVideoComposition. The README example shows both.
- Composition sources use app-accessible local filesystem paths.
- Preview width/height are layout points; the drawing callback receives pixel dimensions. Export width/height are pixels.
- Use
lazyDecodersfor sequential timelines. A preview decode limit such asmaxLongSidealso limits source detail if reused during export; use separate settings when necessary. copyanddirectremain API options with the same transport. iOS exports by drawing into the encoder's IOSurface-backed pool buffers; Android draws into AHardwareBuffers lent by the encoder when its AHardwareBuffer interop is available. Both fall back to CPU readback after a failed setup probe. InspectgetVideoResourceStats().backendfor the transport instead of inferring it from the requested mode.- Review application code that calls internal extractors or directly consumes native textures. Its frames must follow the new ownership protocol; the renamed hooks do not preserve the old texture representation.
Audio options retain their existing meaning. A video composition item is silent by default; use audio: true or audio: { volume: 0.8 } to include its audio during playback and export. Separate kind: 'audio' items support music or voice-over. useVideoPlayback has its own volume option.
Audio is implemented on both native platforms, but the device runs so far (3.0.6, 3.4.4, 3.6.1 and 3.7.0) did not exercise audible output or validate audio synchronization. Test these paths with your application's actual sources before shipping.
Set configureVideoMemory({ maxBytes }) before allocating sessions. The budget covers tracked resources only; codecs and drivers can retain additional memory. A budget rejection does not silently reduce export dimensions.
On Android with the AHardwareBuffer interop (API 29+, 8-bit SDR H.264/HEVC), the codec writes into an ImageReader; WebGPU converts, crops, rotates and scales each YUV buffer, imported once, to the frame's size (a maxLongSide cap or an explicit resolution included) in an independent Graphite snapshot after a checked GPU fence. Exports skip that snapshot: each clip's frame is converted into a texture of its own and sampled in place, as on iOS. Other sources render through the decoder's private EGL context into an RGBA AHardwareBuffer, or, without the interop, read owned RGBA pixels on the CPU and upload them. All of these avoid Skia's image-count raster-upload cache. CPU Java/JSI backing buffers remain accounted until their aliases and ART/Hermes owners are collected. See the upstream cache notes and the 3.6.1 verification.
The optional createFrameProcessor export factory creates a processor once per export. Its asynchronous prepareFrame runs at the requested composition timestamp and its dispose must finish all frame readers. Drive animated effects from that timestamp, not an independent display animation loop.
For GPU work, create createVideoGpuScope on the runtime that uses it. The Skia device is shared: do not destroy it or pass command encoders across runtimes. Track asynchronous work before starting it, remove images from consumers, and await scope.dispose(). CPU/ML inference needs its own tracked completion; a graphics fence does not finish unrelated inference.
If completion cannot be established after an error, the library can retain the affected state and reject later work to avoid releasing resources still in use. Zero tracked reservations alone is not proof that all process or GPU memory has been returned.
Check orientation, seek/loop behavior, source audio and added tracks, export dimensions and timestamps, cancellation, and repeated mount/export/unmount cycles on both platforms. Existing Skia patches, custom texture loaders, Skottie integrations, and application-specific effects require their own migration review.
See the benchmark guide and current iPhone comparison for what has actually been measured. Performance results are specific to their workloads and conditions.