diff --git a/README.md b/README.md index e43d8f64..c353222a 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ In addition, the `` also takes these props: | seekColor | String(#HEX) | '#FFF' | Fill/handle colour of the seekbar | | style | StyleSheet | null | React Native StyleSheet object that is appended to the video's parent `` | | tapAnywhereToPause | Boolean | false | If true, single tapping anywhere on the video (other than a control) toggles between playing and paused. | +| controlRate | Boolean | false | If true, show the control Rate button \[x1\] (Playback Speed). | | showTimeRemaining | Boolean | true | If true, show the time remaing, else show the current time in the Player. `` diff --git a/VideoPlayer.js b/VideoPlayer.js index 3ee8323e..160caa9c 100644 --- a/VideoPlayer.js +++ b/VideoPlayer.js @@ -1,4 +1,4 @@ -import React, {Component} from 'react'; +import React, { Component } from 'react'; import Video from 'react-native-video'; import { TouchableWithoutFeedback, @@ -33,6 +33,7 @@ export default class VideoPlayer extends Component { rate: 1, showTimeRemaining: true, showHours: false, + controlRate: false, }; constructor(props) { @@ -110,6 +111,7 @@ export default class VideoPlayer extends Component { togglePlayPause: this._togglePlayPause.bind(this), toggleControls: this._toggleControls.bind(this), toggleTimer: this._toggleTimer.bind(this), + toggleRate: this._toggleRate.bind(this), }; /** @@ -162,7 +164,7 @@ export default class VideoPlayer extends Component { } componentDidUpdate = prevProps => { - const {isFullscreen} = this.props; + const { isFullscreen } = this.props; if (prevProps.isFullscreen !== isFullscreen) { this.setState({ @@ -271,7 +273,7 @@ export default class VideoPlayer extends Component { * Either close the video or go to a * new page. */ - _onEnd() {} + _onEnd() { } /** * Set the error state to true which then @@ -516,6 +518,16 @@ export default class VideoPlayer extends Component { this.setState(state); } + /** + * Toggle playback speed state (rate) on