69a7bc2d26
* docs: enable Android PIP * chore: change comments * feat(android): implement Android PictureInPicture * refactor: minor refactor code and apply lint * fix: rewrite pip action intent code for Android14 * fix: remove redundant codes * feat: add isInPictureInPicture flag for lifecycle handling - activity provide helper method for same purpose, but this flag makes code simple * feat: add pipFullscreenPlayerView for makes PIP include video only * fix: add manifest value checker for prevent crash * docs: add pictureInPicture prop's Android guide * fix: sync controller visibility * refactor: refining variable name * fix: check multi window mode when host pause - some OS version call onPause on multi-window mode * fix: handling when onStop is called while in multi-window mode * refactor: enhance PIP util codes * fix: fix FullscreenPlayerView constructor * refactor: add enterPictureInPictureOnLeave prop and pip methods - remove pictureInPicture boolean prop - add enterPictureInPictureOnLeave boolean prop - add enterPictureInPicture method - add exitPictureInPicture method * fix: fix lint error * fix: prevent audio play in background without playInBackground prop * fix: fix onDetachedFromWindow * docs: update docs for pip * fix(android): sync pip controller with external controller state - for media session * fix(ios): fix pip active fn variable reference * refactor(ios): refactor code * refactor(android): refactor codes * fix(android): fix lint error * refactor(android): refactor android pip logics * fix(android): fix flickering issue when stop picture in picture * fix(android): fix import * fix(android): fix picture in picture with fullscreen mode * fix(ios): fix syntax error * fix(android): fix Fragment managed code * refactor(android): remove redundant override lifecycle * fix(js): add PIP type definition for codegen * fix(android): fix syntax * chore(android): fix lint error * fix(ios): fix enter background handler * refactor(ios): remove redundant code * fix(ios): fix applicationDidEnterBackground for PIP * fix(android): fix onPictureInPictureStatusChanged * fix(ios): fix RCTPictureInPicture * refactor(android): Ignore exception for some device ignore pip checker - some device ignore PIP availability check, so we need to handle exception to prevent crash * fix(android): add hideWithoutPlayer fn into Kotlin ver * refactor(android): remove redundant code * fix(android): fix pip ratio to be calculated with correct ratio value * fix(android): fix crash issue when unmounting in PIP mode * fix(android): fix lint error * Update android/src/main/java/com/brentvatne/react/VideoManagerModule.kt * fix(android): fix lint error * fix(ios): fix lint error * fix(ios): fix lint error * feat(expo): add android picture in picture config within expo plugin * fix: Replace Fragment with androidx.activity - remove code that uses Fragment, which is a tricky implementation * fix: fix lint error * fix(android): disable auto enter when player released * fix(android): fix event handler to check based on Activity it's bound to --------- Co-authored-by: jonghun <jonghun@toss.im> Co-authored-by: Olivier Bouillet <62574056+freeboub@users.noreply.github.com>
72 lines
2.1 KiB
Markdown
72 lines
2.1 KiB
Markdown
# A `<Video>` component for React Native
|
|
|
|
## About
|
|
`react-native-video` is a React Native library that provides a Video component that renders media content such as videos and streams
|
|
|
|
It allows to stream video files (m3u, mpd, mp4, ...) inside your react native application.
|
|
|
|
- Exoplayer for android
|
|
- AVplayer for iOS, tvOS and visionOS
|
|
- Windows UWP for windows
|
|
- HTML5 for web
|
|
- Trick mode support
|
|
- Subtitles (embeded or side loaded)
|
|
- DRM support
|
|
- Client side Ads insertion (via google IMA)
|
|
- Pip
|
|
- Embedded playback controls
|
|
- And much more
|
|
|
|
The aim of this package is to have a thin and exhaustive control of player.
|
|
|
|
## V6.0.0 Information
|
|
> ⚠️ **Version 6**: The following documentation refer to features only available through the v6.0.0 releases.
|
|
> As major rework has been done in case of doubt, you can still use [version 5.2.x, see documentation](https://github.com/TheWidlarzGroup/react-native-video/blob/v5.2.0/README.md)
|
|
|
|
Version 6.x requires **react-native >= 0.68.2**
|
|
> ⚠️ from **6.0.0-beta.8** requires also **iOS >= 13.0** (default in react-native 0.73)
|
|
|
|
For older versions of react-native, [please use version 5.x](https://github.com/TheWidlarzGroup/react-native-video/tree/v5.2.0).
|
|
|
|
## Usage
|
|
|
|
```javascript
|
|
// Load the module
|
|
|
|
import Video, {VideoRef} from 'react-native-video';
|
|
|
|
// Within your render function, assuming you have a file called
|
|
// "background.mp4" in your project. You can include multiple videos
|
|
// on a single screen if you like.
|
|
|
|
const VideoPlayer = () => {
|
|
const videoRef = useRef<VideoRef>(null);
|
|
const background = require('./background.mp4');
|
|
|
|
return (
|
|
<Video
|
|
// Can be a URL or a local file.
|
|
source={background}
|
|
// Store reference
|
|
ref={videoRef}
|
|
// Callback when remote video is buffering
|
|
onBuffer={onBuffer}
|
|
// Callback when video cannot be loaded
|
|
onError={onError}
|
|
style={styles.backgroundVideo}
|
|
/>
|
|
)
|
|
}
|
|
|
|
// Later on in your styles..
|
|
var styles = StyleSheet.create({
|
|
backgroundVideo: {
|
|
position: 'absolute',
|
|
top: 0,
|
|
left: 0,
|
|
bottom: 0,
|
|
right: 0,
|
|
},
|
|
});
|
|
```
|