Merge pull request #19523 from abrahambotros/react-native-video/on-progress-data

[react-native-video] Add `onProgress` data
This commit is contained in:
Nathan Shively-Sanders
2017-09-05 15:47:28 -07:00
committed by GitHub
2 changed files with 18 additions and 4 deletions
+6 -2
View File
@@ -1,6 +1,7 @@
// Type definitions for react-native-video 1.0
// Type definitions for react-native-video 2.0
// Project: https://github.com/react-native-community/react-native-video
// Definitions by: HuHuanming <https://github.com/huhuanming>
// abrahambotros <https://github.com/abrahambotros>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -48,7 +49,10 @@ export interface VideoProperties extends ViewProperties {
onLoad?(): void;
onBuffer?(): void;
onError?(): void;
onProgress?(): void;
onProgress?(data: {
currentTime: number,
playableDuration: number,
}): void;
onSeek?(): void;
onEnd?(): void;
onFullscreenPlayerWillPresent?(): void;
@@ -7,16 +7,26 @@ import {
} from 'react-native';
import Video from 'react-native-video';
class SwiperTest extends React.Component {
class VideoTest extends React.Component {
constructor(props: {}) {
super(props);
}
render(): React.ReactElement<any> {
return (
<Video source={{uri: '//:example.com/test.mp4'}}/>
<Video
source={{ uri: '//:example.com/test.mp4' }}
onProgress={this.onProgress}
/>
);
}
onProgress = (data: {
currentTime: number,
playableDuration: number,
}): void => {
console.log(data.currentTime, data.playableDuration);
}
}
const styles = StyleSheet.create({