From 0ee351b458dd4fff0dfcb81fab62014181fba2d2 Mon Sep 17 00:00:00 2001 From: Richard Roncancio Date: Tue, 20 Feb 2018 14:10:01 -0500 Subject: [PATCH] Fix video not autoplaying on IOS after a re-render --- VideoPlayer.js | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/VideoPlayer.js b/VideoPlayer.js index db5f77e..6d0fe56 100644 --- a/VideoPlayer.js +++ b/VideoPlayer.js @@ -19,7 +19,16 @@ import _ from 'lodash'; export default class VideoPlayer extends Component { static defaultProps = { - showOnStart: true + showOnStart: true, + resizeMode: 'contain', + playWhenInactive: false, + playInBackground: false, + title: '', + repeat: false, + paused: false, + muted: false, + volume: 1, + rate: 1, }; constructor( props ) { @@ -31,11 +40,11 @@ export default class VideoPlayer extends Component { */ this.state = { // Video - resizeMode: this.props.resizeMode || 'contain', - paused: this.props.paused || false, - muted: this.props.muted || false, - volume: this.props.volume || 1, - rate: this.props.rate || 1, + resizeMode: this.props.resizeMode, + paused: this.props.paused, + muted: this.props.muted, + volume: this.props.volume, + rate: this.props.rate, // Controls isFullscreen: this.props.resizeMode === 'cover' || false, @@ -60,10 +69,10 @@ export default class VideoPlayer extends Component { * Any options that can be set at init. */ this.opts = { - playWhenInactive: this.props.playWhenInactive || false, - playInBackground: this.props.playInBackground || false, - repeat: this.props.repeat || false, - title: this.props.title || '', + playWhenInactive: this.props.playWhenInactive, + playInBackground: this.props.playInBackground, + repeat: this.props.repeat, + title: this.props.title, }; /**