1.0.3 • Published 6 years ago
react-native-native-video-player-caller v1.0.3
react-native-native-video-player-caller
Getting started
$ npm i react-native-native-video-player-caller
Mostly automatic installation
$ react-native link react-native-native-video-player-caller
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-native-video-player-callerand addNativeVideoPlayerCaller.xcodeproj - In XCode, in the project navigator, select your project. Add
libNativeVideoPlayerCaller.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
Or add pod spec to your pod file.
pod 'react-native-native-video-player-caller', :path => '../node_modules/react-native-native-video-player-caller'
Android
- Open up
android/app/src/main/java/[...]/MainApplication.java
- Add
import com.reactlibrary.NativeVideoPlayerCallerPackage;to the imports at the top of the file - Add
new NativeVideoPlayerCallerPackage()to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':react-native-native-video-player-caller' project(':react-native-native-video-player-caller').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-native-video-player-caller/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:compile project(':react-native-native-video-player-caller')
Usage
import NativeVideoPlayerCaller from 'react-native-native-video-player-caller';
const uri = Platform.OS === 'ios' // On RN 59
? `assets-library://asset/asset.MOV?id=${videoURI.substring(5, 41)}&ext=MOV`
: videoURI
NativeVideoPlayerCaller.showVideoPlayer(uri)