Files
video.js-mirror/packages/react-native/README.md

45 lines
1.2 KiB
Markdown

# react-native
video.js for react-native
## Installation
```sh
npm install @videojs/react-native react-native-svg
```
`react-native-svg` is a peer dependency: the skin's icons render through it. It has native code, so rebuild the app
(and run `pod install` on iOS) after adding it.
Requires React Native 0.76 or later with the New Architecture enabled (the default since 0.76): the player view is a
Fabric component and the engine is a TurboModule, both generated from `codegenConfig`. React 18 and 19 are supported.
## Usage
```tsx
import { StyleSheet } from "react-native";
import { Video, VideoPlayer, VideoSkin } from "@videojs/react-native";
// ...
<VideoPlayer>
<VideoSkin style={{ width: 320, height: 180 }}>
<Video src="https://stream.mux.com/{PLAYBACK_ID}.m3u8" style={StyleSheet.absoluteFill} />
</VideoSkin>
</VideoPlayer>
```
## Contributing
Repository setup and workflow are in the monorepo's
[`CONTRIBUTING.md`](https://github.com/videojs/v10/blob/main/CONTRIBUTING.md). The native toolchain
this package needs, and the example app that exercises it, are documented in
[`apps/react-native/README.md`](https://github.com/videojs/v10/blob/main/apps/react-native/README.md).
## License
MIT