react-native-video
Advanced tools
Comparing version 0.1.6 to 0.1.8
{ | ||
"name": "react-native-video", | ||
"version": "0.1.6", | ||
"version": "0.1.8", | ||
"description": "A <Video> element for react-native", | ||
@@ -5,0 +5,0 @@ "main": "Video.ios.js", |
@@ -10,3 +10,3 @@ ## react-native-video | ||
2. Open your project in XCode, right click on `Libraries` and click `Add | ||
Files to "Your Project Name" [(Screenshot)](http://url.brentvatne.ca/g9Wp). | ||
Files to "Your Project Name"` [(Screenshot)](http://url.brentvatne.ca/g9Wp). | ||
3. Add `libRTCVideo.a` to `Build Phases -> Link Binary With Libraries` | ||
@@ -31,3 +31,4 @@ [(Screenshot)](http://url.brentvatne.ca/g9Wp). | ||
// on a single screen if you like. | ||
<Video source={"background"} style={styles.backgroundVideo} repeat={true} /> | ||
<Video source={"background"} style={styles.backgroundVideo} | ||
resizeMode="cover" repeat={true} /> | ||
@@ -37,3 +38,2 @@ // Later on in your styles.. | ||
backgroundVideo: { | ||
resizeMode: 'cover', // stretch and contain also supported | ||
position: 'absolute', | ||
@@ -54,4 +54,13 @@ top: 0, | ||
- [ ] Support other extensions than mp4? | ||
- [x] Add prop to set repeat (none or forever) | ||
- [x] Switch to AVPlayer | ||
- [ ] Add support [for other AVPlayer props](https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVPlayer_Class/index.html) | ||
- [x] Switch to AVPlayer (0.1.6) | ||
- [x] Switch resizeMode to prop instead of style (0.1.7) | ||
- [x] Add `pause` prop (0.1.7) | ||
- [ ] Add `playbackRate` prop | ||
- [ ] Add `volume` prop | ||
- [ ] Add `muted` prop | ||
- [ ] Add some way to get back the `currentTime` value | ||
- [ ] Add some way to get back the `totalTime` value | ||
- [ ] Add some way to interface with `seekToTime` | ||
- [ ] Add support for captions | ||
- [ ] Add support for playing multiple videos in a sequence (will interfere with current `repeat` implementation) | ||
- [ ] Any other [for other AVPlayer props](https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVPlayer_Class/index.html) |
@@ -1,2 +0,2 @@ | ||
var React = require('React'); | ||
var React = require('react-native'); | ||
var NativeModules = require('NativeModules'); | ||
@@ -18,3 +18,6 @@ var ReactIOSViewAttributes = require('ReactIOSViewAttributes'); | ||
style: StyleSheetPropType(VideoStylePropTypes), | ||
resizeMode: PropTypes.string, | ||
repeat: PropTypes.bool, | ||
pause: PropTypes.bool, | ||
onLoad: PropTypes.func, | ||
}, | ||
@@ -29,3 +32,7 @@ | ||
render: function() { | ||
_onLoad(event) { | ||
this.props.onLoad && this.props.onLoad(event.nativeEvent); | ||
}, | ||
render() { | ||
var style = flattenStyle([styles.base, this.props.style]); | ||
@@ -35,9 +42,10 @@ var source = this.props.source; | ||
var resizeMode; | ||
var contentModes = NativeModules.VideoManager; | ||
if (style.resizeMode === VideoResizeMode.stretch) { | ||
resizeMode = contentModes.ScaleToFill; | ||
} else if (style.resizeMode === VideoResizeMode.contain) { | ||
resizeMode = contentModes.ScaleAspectFit; | ||
if (this.props.resizeMode === VideoResizeMode.stretch) { | ||
resizeMode = NativeModules.VideoManager.ScaleToFill; | ||
} else if (this.props.resizeMode === VideoResizeMode.contain) { | ||
resizeMode = NativeModules.VideoManager.ScaleAspectFit; | ||
} else if (this.props.resizeMode == VideoResizeMode.cover) { | ||
resizeMode = NativeModules.VideoManager.ScaleAspectFill; | ||
} else { | ||
resizeMode = contentModes.ScaleAspectFill; | ||
resizeMode = NativeModules.VideoManager.ScaleNone; | ||
} | ||
@@ -47,4 +55,5 @@ | ||
style, | ||
resizeMode, | ||
resizeMode: resizeMode, | ||
src: source, | ||
onLoad: this._onLoad, | ||
}); | ||
@@ -57,3 +66,4 @@ | ||
var RCTVideo = createReactIOSNativeComponentClass({ | ||
validAttributes: merge(ReactIOSViewAttributes.UIView, {src: true, resizeMode: true, repeat: true}), | ||
validAttributes: merge(ReactIOSViewAttributes.UIView, | ||
{src: true, resizeMode: true, repeat: true, pause: true}), | ||
uiViewClassName: 'RCTVideo', | ||
@@ -60,0 +70,0 @@ }); |
@@ -9,5 +9,4 @@ 'use strict'; | ||
...LayoutPropTypes, | ||
resizeMode: ReactPropTypes.oneOf(Object.keys(VideoResizeMode)), | ||
}; | ||
module.exports = VideoStylePropTypes; |
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
18787
86
63