react-native-video
Advanced tools
Comparing version 0.7.1 to 0.8.0-beta
{ | ||
"name": "react-native-video", | ||
"version": "0.7.1", | ||
"version": "0.8.0-beta", | ||
"description": "A <Video /> element for react-native", | ||
"main": "Video.js", | ||
"license": "MIT", | ||
"author": "Brent Vatne <brentvatne@gmail.com> (https://github.com/brentvatne)", | ||
@@ -21,4 +22,10 @@ "files": [ | ||
"README.md", | ||
"UIView+FindUIViewController.h", | ||
"UIView+FindUIViewController.m", | ||
"RCTVideoPlayerViewController.h", | ||
"RCTVideoPlayerViewController.m", | ||
"RCTVideoPlayerViewControllerDelegate.h", | ||
"Video.js", | ||
"VideoResizeMode.js" | ||
"VideoResizeMode.js", | ||
"react-native-video.podspec" | ||
], | ||
@@ -25,0 +32,0 @@ "contributors": [ |
@@ -6,3 +6,3 @@ ## react-native-video | ||
Requires react-native >= 0.4.4 | ||
Requires react-native >= 0.19.0 | ||
@@ -15,13 +15,8 @@ ### Add it to your project | ||
1. Open your project in XCode, right click on `Libraries` and click `Add Files to "Your Project Name"` | ||
* ![Screenshot](http://url.brentvatne.ca/jQp8.png) ![Screenshot](http://url.brentvatne.ca/1gqUD.png) (use the RCTVideo project rather than the one pictured in screenshot). | ||
2. Add `libRTCVideo.a` to `Build Phases -> Link Binary With Libraries` | ||
![(Screenshot)](http://url.brentvatne.ca/g9Wp.png). | ||
3. Add `.mp4` video file to project and to `Build Phases -> Copy Bundle Resources` | ||
4. Whenever you want to use it within React code now you can: `var Video = | ||
require('react-native-video');` | ||
Install [rnpm](https://github.com/rnpm/rnpm) and run `rnpm link react-native-video` | ||
#### Android | ||
Make the following additions to the given files. | ||
First, copy your video file to `android/app/src/main/res/raw/`, then | ||
make the following additions to the given files: | ||
@@ -75,3 +70,3 @@ **android/settings.gradle** | ||
// Later on in your styles.. | ||
var styles = Stylesheet.create({ | ||
var styles = StyleSheet.create({ | ||
backgroundVideo: { | ||
@@ -95,3 +90,3 @@ position: 'absolute', | ||
- See an [Example integration][1] in `react-native-login`. | ||
- See an [Example integration][1] in `react-native-login` *note that this example uses an older version of this library, before we used `export default` -- if you use `require` you will need to do `require('react-native-video').default` as per instructions above. | ||
- Try the included [VideoPlayer example][2] yourself: | ||
@@ -109,8 +104,5 @@ | ||
## TODOS | ||
- [ ] Add some way to interface with `seekToTime` | ||
- [ ] Add support for captions | ||
- [ ] Support `require('video!...')` | ||
- [ ] Add support for playing multiple videos in a sequence (will interfere with current `repeat` implementation) | ||
@@ -117,0 +109,0 @@ - [ ] Callback to get buffering progress for remote videos |
50
Video.js
@@ -24,2 +24,4 @@ import React from 'react-native'; | ||
this.seek = this.seek.bind(this); | ||
this.presentFullscreenPlayer = this.presentFullscreenPlayer.bind(this); | ||
this.dismissFullscreenPlayer = this.dismissFullscreenPlayer.bind(this); | ||
this._assignRoot = this._assignRoot.bind(this); | ||
@@ -32,2 +34,6 @@ this._onLoadStart = this._onLoadStart.bind(this); | ||
this._onEnd = this._onEnd.bind(this); | ||
this._onFullscreenPlayerWillPresent = this._onFullscreenPlayerWillPresent.bind(this); | ||
this._onFullscreenPlayerDidPresent = this._onFullscreenPlayerDidPresent.bind(this); | ||
this._onFullscreenPlayerWillDismiss = this._onFullscreenPlayerWillDismiss.bind(this); | ||
this._onFullscreenPlayerDidDismiss = this._onFullscreenPlayerDidDismiss.bind(this); | ||
} | ||
@@ -43,2 +49,10 @@ | ||
presentFullscreenPlayer() { | ||
this.setNativeProps({ fullscreen: true }); | ||
} | ||
dismissFullscreenPlayer() { | ||
this.setNativeProps({ fullscreen: false }); | ||
} | ||
_assignRoot(component) { | ||
@@ -84,2 +98,26 @@ this._root = component; | ||
_onFullscreenPlayerWillPresent(event) { | ||
if (this.props.onFullscreenPlayerWillPresent) { | ||
this.props.onFullscreenPlayerWillPresent(event.nativeEvent); | ||
} | ||
} | ||
_onFullscreenPlayerDidPresent(event) { | ||
if (this.props.onFullscreenPlayerDidPresent) { | ||
this.props.onFullscreenPlayerDidPresent(event.nativeEvent); | ||
} | ||
} | ||
_onFullscreenPlayerWillDismiss(event) { | ||
if (this.props.onFullscreenPlayerWillDismiss) { | ||
this.props.onFullscreenPlayerWillDismiss(event.nativeEvent); | ||
} | ||
} | ||
_onFullscreenPlayerDidDismiss(event) { | ||
if (this.props.onFullscreenPlayerDidDismiss) { | ||
this.props.onFullscreenPlayerDidDismiss(event.nativeEvent); | ||
} | ||
} | ||
render() { | ||
@@ -97,3 +135,3 @@ const { | ||
const isNetwork = !!(uri && uri.match(/^https?:/)); | ||
const isAsset = !!(uri && uri.match(/^(assets-library|file):/)); | ||
const isAsset = !!(uri && uri.match(/^(assets-library|file|content):/)); | ||
@@ -127,2 +165,6 @@ let nativeResizeMode; | ||
onVideoEnd: this._onEnd, | ||
onVideoFullscreenPlayerWillPresent: this._onFullscreenPlayerWillPresent, | ||
onVideoFullscreenPlayerDidPresent: this._onFullscreenPlayerDidPresent, | ||
onVideoFullscreenPlayerWillDismiss: this._onFullscreenPlayerWillDismiss, | ||
onVideoFullscreenPlayerDidDismiss: this._onFullscreenPlayerDidDismiss, | ||
}); | ||
@@ -143,2 +185,3 @@ | ||
seek: PropTypes.number, | ||
fullscreen: PropTypes.bool, | ||
@@ -161,2 +204,6 @@ /* Wrapper component */ | ||
onEnd: PropTypes.func, | ||
onFullscreenPlayerWillPresent: PropTypes.func, | ||
onFullscreenPlayerDidPresent: PropTypes.func, | ||
onFullscreenPlayerWillDismiss: PropTypes.func, | ||
onFullscreenPlayerDidDismiss: PropTypes.func, | ||
@@ -176,3 +223,4 @@ /* Required by react-native */ | ||
seek: true, | ||
fullscreen: true, | ||
}, | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
23
548
73525
113