How to play network and assets video using react-native-video
井民全, Jing, mqjing@gmail.com
[hybrid, cross] Ionic, React Native, Cordova, Electron
GitHub: Download
Mr.Joaquin Viera wrote a good tutorial on how to use react-native-video to play an mp4 video. This document just follows his work with noting some detailed procedures and troubleshooting.
Table of contents
2.2.1. Step 1: Create a component for video play 5
2.2.2. Step 2: Usage the component 7
2.2.3. Step 3: Setup the video asset 8
3.1. Build failure: error: no member named 'react' in namespace 'facebook' ... 9
1. Quick
2. Detail
2.1. Setup Project
Step 1: Cerate a template project
2.1.1. iOS
Step 2: Download and Install Pods for project
Test
Result
2.1.2. Install dependencies
2.2. Code
2.2.1. Step 1: Create a component for video play
Commands
File: components/VideoPlayer.js (this code was copied from here)
2.2.2. Step 2: Usage the component
File: app.js
2.2.3. Step 3: Setup the video asset
2.3. Build & Run
iOS
2.4. Result
3. Troubleshooting
iOS
3.1. Build failure: error: no member named 'react' in namespace 'facebook' ...
Error Message
Solution
Clean the XCode Cache
3.2. Build failure: TypeError: undefined is not an object (evaluating 'RCTVideoInstance.Constants')
Error Message
Solution
Make sure the XCode project including librect-native-video.a