- Android
- iOS
- Web
Video Player
Play a clip with the engine’s media component.
Engine API VideoPlayernayan-ui/video
Serve a video file from your app and pass its URL to VideoPlayer.
Example.tsx
| Name | Type | Default | Details |
|---|---|---|---|
| source | VideoSource | Required | |
| controls | boolean | Optional | Show the platform's playback controls. Defaults to true. |
| autoPlay | boolean | Optional | Start a new source automatically when the platform allows it. Defaults to false. |
| loop | boolean | Optional | |
| muted | boolean | Optional | |
| volume | number | Optional | Volume from 0 to 1 where supported. Defaults to 1. |
| contentFit | VideoContentFit | Optional | |
| style | CSSProperties | Optional | |
| ref | Ref<VideoPlayerHandle> | Optional | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
| onStatusChange | ((status: VideoStatus) => void) | Optional | |
| onProgress | ((progress: VideoProgress) => void) | Optional | |
| onError | ((error: Error) => void) | Optional |
React Native API
| Name | Type | Default | Details |
|---|---|---|---|
| source | number | VideoSource | Required | A URI or a React Native bundled asset returned by require(). |
| controls | boolean | Optional | Show the platform's playback controls. Defaults to true. |
| autoPlay | boolean | Optional | Start a new source automatically when the platform allows it. Defaults to false. |
| loop | boolean | Optional | |
| muted | boolean | Optional | |
| volume | number | Optional | Volume from 0 to 1 where supported. Defaults to 1. |
| contentFit | VideoContentFit | Optional | |
| style | StyleProp<ViewStyle> | Optional | |
| ref | Ref<VideoPlayerHandle> | Optional | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
| onStatusChange | ((status: VideoStatus) => void) | Optional | |
| onProgress | ((progress: VideoProgress) => void) | Optional | |
| onError | ((error: Error) => void) | Optional |