add ability to change progress update interval (#289)
* added progressUpdateInterval prop iOS * add prop to Video.js * added progressUpdateInterval prop iOS * add prop to Video.js
This commit is contained in:
parent
0c746e8fe8
commit
6b62119ce0
34
README.md
34
README.md
@ -86,23 +86,23 @@ Under `.addPackage(new MainReactPackage())`:
|
|||||||
// Within your render function, assuming you have a file called
|
// Within your render function, assuming you have a file called
|
||||||
// "background.mp4" in your project. You can include multiple videos
|
// "background.mp4" in your project. You can include multiple videos
|
||||||
// on a single screen if you like.
|
// on a single screen if you like.
|
||||||
<Video
|
|
||||||
source={{uri: "background"}} // Can be a URL or a local file.
|
<Video source={{uri: "background"}} // Can be a URL or a local file.
|
||||||
rate={1.0} // 0 is paused, 1 is normal.
|
rate={1.0} // 0 is paused, 1 is normal.
|
||||||
volume={1.0} // 0 is muted, 1 is normal.
|
volume={1.0} // 0 is muted, 1 is normal.
|
||||||
muted={false} // Mutes the audio entirely.
|
muted={false} // Mutes the audio entirely.
|
||||||
paused={false} // Pauses playback entirely.
|
paused={false} // Pauses playback entirely.
|
||||||
resizeMode="cover" // Fill the whole screen at aspect ratio.
|
resizeMode="cover" // Fill the whole screen at aspect ratio.
|
||||||
repeat={true} // Repeat forever.
|
repeat={true} // Repeat forever.
|
||||||
playInBackground={false} // Audio continues to play when aentering background.
|
playInBackground={false} // Audio continues to play when app entering background.
|
||||||
playWhenInactive={false} // [iOS] Video continues to play whcontrol or notification center are shown.
|
playWhenInactive={false} // [iOS] Video continues to play when control or notification center are shown.
|
||||||
onLoadStart={this.loadStart} // Callback when video starts to load
|
progressUpdateInterval={250.0} // [iOS] Interval to fire onProgress (default to ~250ms)
|
||||||
onLoad={this.setDuration} // Callback when video loads
|
onLoadStart={this.loadStart} // Callback when video starts to load
|
||||||
onProgress={this.setTime} // Callback every ~250ms with currentTime
|
onLoad={this.setDuration} // Callback when video loads
|
||||||
onEnd={this.onEnd} // Callback when playback finishes
|
onProgress={this.setTime} // Callback every ~250ms with currentTime
|
||||||
onError={this.videoError} // Callback when video cannot be loaded
|
onEnd={this.onEnd} // Callback when playback finishes
|
||||||
style={styles.backgroundVideo}
|
onError={this.videoError} // Callback when video cannot be loaded
|
||||||
/>
|
style={styles.backgroundVideo} />
|
||||||
|
|
||||||
// Later on in your styles..
|
// Later on in your styles..
|
||||||
var styles = StyleSheet.create({
|
var styles = StyleSheet.create({
|
||||||
|
1
Video.js
1
Video.js
@ -199,6 +199,7 @@ Video.propTypes = {
|
|||||||
playWhenInactive: PropTypes.bool,
|
playWhenInactive: PropTypes.bool,
|
||||||
controls: PropTypes.bool,
|
controls: PropTypes.bool,
|
||||||
currentTime: PropTypes.number,
|
currentTime: PropTypes.number,
|
||||||
|
progressUpdateInterval: PropTypes.number,
|
||||||
onLoadStart: PropTypes.func,
|
onLoadStart: PropTypes.func,
|
||||||
onLoad: PropTypes.func,
|
onLoad: PropTypes.func,
|
||||||
onError: PropTypes.func,
|
onError: PropTypes.func,
|
||||||
|
@ -636,6 +636,11 @@ static NSString *const playbackRate = @"rate";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setProgressUpdateInterval:(float)progressUpdateInterval
|
||||||
|
{
|
||||||
|
_progressUpdateInterval = progressUpdateInterval;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)removePlayerLayer
|
- (void)removePlayerLayer
|
||||||
{
|
{
|
||||||
[_playerLayer removeFromSuperlayer];
|
[_playerLayer removeFromSuperlayer];
|
||||||
|
@ -54,6 +54,7 @@ RCT_EXPORT_VIEW_PROPERTY(rate, float);
|
|||||||
RCT_EXPORT_VIEW_PROPERTY(seek, float);
|
RCT_EXPORT_VIEW_PROPERTY(seek, float);
|
||||||
RCT_EXPORT_VIEW_PROPERTY(currentTime, float);
|
RCT_EXPORT_VIEW_PROPERTY(currentTime, float);
|
||||||
RCT_EXPORT_VIEW_PROPERTY(fullscreen, BOOL);
|
RCT_EXPORT_VIEW_PROPERTY(fullscreen, BOOL);
|
||||||
|
RCT_EXPORT_VIEW_PROPERTY(progressUpdateInterval, float);
|
||||||
|
|
||||||
- (NSDictionary *)constantsToExport
|
- (NSDictionary *)constantsToExport
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user