From 648a11c9785dec47b74f48fbe745ff911b7f2df2 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 4 Sep 2018 09:36:48 +0100 Subject: [PATCH] tapping on the player controls container while it is visible should hide the container --- app/src/component/mediaPlayer/view.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/component/mediaPlayer/view.js b/app/src/component/mediaPlayer/view.js index 38de91b8..2b2b0459 100644 --- a/app/src/component/mediaPlayer/view.js +++ b/app/src/component/mediaPlayer/view.js @@ -115,6 +115,11 @@ class MediaPlayer extends React.PureComponent { this.hidePlayerControls(); } + manualHidePlayerControls = () => { + this.clearControlsTimeout(); + this.setState({ areControlsVisible: false }); + } + hidePlayerControls() { const player = this; let timeout = setTimeout(() => { @@ -123,6 +128,14 @@ class MediaPlayer extends React.PureComponent { player.setState({ controlsTimeout: timeout }); } + togglePlayerControls = () => { + if (this.state.areControlsVisible) { + this.manualHidePlayerControls(); + } else { + this.showPlayerControls(); + } + } + togglePlay = () => { this.showPlayerControls(); this.setState({ paused: !this.state.paused }); @@ -342,7 +355,7 @@ class MediaPlayer extends React.PureComponent { onEnd={this.onEnd} /> - + {this.renderPlayerControls()}