You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
auto prefers the shared HLS proxy and falls back to direct when the proxy cannot be readied for the active source generation. direct skips proxy routing. proxy forces proxy routing.
NitroSourcePreviewConfig
Field
Type
Default
Purpose
mode
'listener' | 'always' | 'manual'
listener
Automatic first-frame behavior
autoThumbnail
boolean
true
Native auto-thumbnail placeholder for attached views
maxWidth
number
480
Output width hint
maxHeight
number
480
Output height hint
quality
number
70
JPEG quality hint
See docs/source-config.md for source profiles and identity rules, and docs/buffer-config.md for BufferConfig (Android minBufferMs, maxBufferMs, iOS preferredForwardBufferDurationMs, preferredPeakBitRate, shared livePlayback).
All source-taking methods accept either a URL string or { uri, headers }. Use the object form whenever headers are part of request identity. See docs/stream-runtime.md.
Resolves React Native asset references via Image.resolveAssetSource, validates the URI, and returns a hybrid NitroPlayerSource. Usually you do not need to call this manually: NitroPlayerView and NitroPlayer accept a plain NitroSourceConfig and normalize it internally. Call createNitroSource explicitly when you want to reuse the same native source object across multiple replaceSourceAsync calls.
Typed error hierarchy used by onError and thrown runtime errors
Runtime Contract
Area
Behavior
Early play
play() before onLoad is canonical
Playback state
Built from native readiness, buffering, and actual playing state
HLS startup
Native runtime uses lazy startup and bounded startup recovery
Proxy fallback
transport.mode='auto' may fall back to direct URL if proxy is unavailable
First frame
onFirstFrame is sticky per active source generation
Preview policy
preview.mode='listener' auto-captures for attached views when autoThumbnail !== false; always warms preview automatically; manual disables background auto-warmup
Mounted-view reveal
Attached NitroPlayerView owns native auto-thumbnail/first-frame placeholder by default; app code should not require JS poster swapping for active playback surfaces
videoPreview.peekFirstFrame(source) returns only an existing cached frame path and never starts generation
Stream/preview identity
{ uri, headers } is the canonical identity for cache stats and preview artifacts
Stream cache
streamCache.prefetch(source) is safe to call repeatedly
Absolute local file paths are accepted on both iOS and Android and are normalized internally to file:// URLs. App code should prefer canonical file:// URIs when it owns freshly recorded media paths.
Example App
The local example is a runtime lab, not just a smoke test.
It covers:
hero playback switching between transport.mode='auto', header-isolated HLS, and direct MP4
streamCache.prefetch/getStats/clear and videoPreview.getFirstFrame/peekFirstFrame/clear
a three-player feed stress block with the same HLS URL under different headers
live observation of onLoad, onError, onFirstFrame, bandwidth, attach state, and isVisualReady