Merge branch 'master' into master

This commit is contained in:
Hampton Maxwell
2018-06-22 18:57:58 -07:00
committed by GitHub
14 changed files with 484 additions and 65 deletions

View File

@@ -1,7 +1,8 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {StyleSheet, requireNativeComponent, NativeModules, View, ViewPropTypes, Image} from 'react-native';
import {StyleSheet, requireNativeComponent, NativeModules, View, ViewPropTypes, Image, Platform} from 'react-native';
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
import TextTrackType from './TextTrackType';
import VideoResizeMode from './VideoResizeMode.js';
const styles = StyleSheet.create({
@@ -10,6 +11,8 @@ const styles = StyleSheet.create({
},
});
export { TextTrackType };
export default class Video extends Component {
constructor(props) {
@@ -47,8 +50,17 @@ export default class Video extends Component {
return strObj;
}
seek = (time) => {
this.setNativeProps({ seek: time });
seek = (time, tolerance = 100) => {
if (Platform.OS === 'ios') {
this.setNativeProps({
seek: {
time,
tolerance
}
});
} else {
this.setNativeProps({ seek: time });
}
};
presentFullscreenPlayer = () => {
@@ -88,7 +100,7 @@ export default class Video extends Component {
};
_onSeek = (event) => {
if (this.state.showPoster) {
if (this.state.showPoster && !this.props.audioOnly) {
this.setState({showPoster: false});
}
@@ -152,7 +164,7 @@ export default class Video extends Component {
};
_onPlaybackRateChange = (event) => {
if (this.state.showPoster && (event.nativeEvent.playbackRate !== 0)) {
if (this.state.showPoster && event.nativeEvent.playbackRate !== 0 && !this.props.audioOnly) {
this.setState({showPoster: false});
}
@@ -271,7 +283,10 @@ export default class Video extends Component {
Video.propTypes = {
/* Native only */
src: PropTypes.object,
seek: PropTypes.number,
seek: PropTypes.oneOfType([
PropTypes.number,
PropTypes.object
]),
fullscreen: PropTypes.bool,
onVideoLoadStart: PropTypes.func,
onVideoLoad: PropTypes.func,
@@ -298,6 +313,7 @@ Video.propTypes = {
poster: PropTypes.string,
posterResizeMode: Image.propTypes.resizeMode,
repeat: PropTypes.bool,
allowsExternalPlayback: PropTypes.bool,
selectedTextTrack: PropTypes.shape({
type: PropTypes.string.isRequired,
value: PropTypes.oneOfType([
@@ -305,6 +321,18 @@ Video.propTypes = {
PropTypes.number
])
}),
textTracks: PropTypes.arrayOf(
PropTypes.shape({
title: PropTypes.string,
uri: PropTypes.string.isRequired,
type: PropTypes.oneOf([
TextTrackType.SRT,
TextTrackType.TTML,
TextTrackType.VTT,
]),
language: PropTypes.string.isRequired
})
),
paused: PropTypes.bool,
muted: PropTypes.bool,
volume: PropTypes.number,
@@ -315,6 +343,7 @@ Video.propTypes = {
ignoreSilentSwitch: PropTypes.oneOf(['ignore', 'obey']),
disableFocus: PropTypes.bool,
controls: PropTypes.bool,
audioOnly: PropTypes.bool,
currentTime: PropTypes.number,
progressUpdateInterval: PropTypes.number,
useTextureView: PropTypes.bool,