Added Android Expansion File Support (#142)
* Add Android Expansion File Support * Added notes for usage with Android Expansion file * Update README.md Added notes re: expansion file usage. * formatting issue fixes
This commit is contained in:
committed by
Matt Apperson
parent
8982843311
commit
4b8101398c
32
README.md
32
README.md
@@ -116,6 +116,38 @@ var styles = StyleSheet.create({
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## Android Expansion File Usage
|
||||
|
||||
```javascript
|
||||
// Within your render function, assuming you have a file called
|
||||
// "background.mp4" in your expansion file. Just add your main and (if applicable) patch version
|
||||
<Video source={{uri: "background", mainVer: 1, patchVer: 0}} // Looks for .mp4 file (background.mp4) in the given expansion version.
|
||||
rate={1.0} // 0 is paused, 1 is normal.
|
||||
volume={1.0} // 0 is muted, 1 is normal.
|
||||
muted={false} // Mutes the audio entirely.
|
||||
paused={false} // Pauses playback entirely.
|
||||
resizeMode="cover" // Fill the whole screen at aspect ratio.
|
||||
repeat={true} // Repeat forever.
|
||||
onLoadStart={this.loadStart} // Callback when video starts to load
|
||||
onLoad={this.setDuration} // Callback when video loads
|
||||
onProgress={this.setTime} // Callback every ~250ms with currentTime
|
||||
onEnd={this.onEnd} // Callback when playback finishes
|
||||
onError={this.videoError} // Callback when video cannot be loaded
|
||||
style={styles.backgroundVideo} />
|
||||
|
||||
// Later on in your styles..
|
||||
var styles = Stylesheet.create({
|
||||
backgroundVideo: {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
### Load files with the RN Asset System
|
||||
|
||||
The asset system [introduced in RN `0.14`](http://www.reactnative.com/react-native-v0-14-0-released/) allows loading image resources shared across iOS and Android without touching native code. As of RN `0.31` [the same is true](https://github.com/facebook/react-native/commit/91ff6868a554c4930fd5fda6ba8044dbd56c8374) of mp4 video assets for Android. As of [RN `0.33`](https://github.com/facebook/react-native/releases/tag/v0.33.0) iOS is also supported. Requires `react-native-video@0.9.0`.
|
||||
|
Reference in New Issue
Block a user