ongoing pre-beta tasks #284

Merged
akinwale merged 10 commits from pre-beta into master 2018-09-05 15:43:40 +02:00
Showing only changes of commit 648a11c978 - Show all commits

View file

@ -115,6 +115,11 @@ class MediaPlayer extends React.PureComponent {
this.hidePlayerControls(); this.hidePlayerControls();
} }
manualHidePlayerControls = () => {
this.clearControlsTimeout();
this.setState({ areControlsVisible: false });
}
hidePlayerControls() { hidePlayerControls() {
const player = this; const player = this;
let timeout = setTimeout(() => { let timeout = setTimeout(() => {
@ -123,6 +128,14 @@ class MediaPlayer extends React.PureComponent {
player.setState({ controlsTimeout: timeout }); player.setState({ controlsTimeout: timeout });
} }
togglePlayerControls = () => {
if (this.state.areControlsVisible) {
this.manualHidePlayerControls();
} else {
this.showPlayerControls();
}
}
togglePlay = () => { togglePlay = () => {
this.showPlayerControls(); this.showPlayerControls();
this.setState({ paused: !this.state.paused }); this.setState({ paused: !this.state.paused });
@ -342,7 +355,7 @@ class MediaPlayer extends React.PureComponent {
onEnd={this.onEnd} onEnd={this.onEnd}
/> />
<TouchableOpacity style={mediaPlayerStyle.playerControls} onPress={this.showPlayerControls}> <TouchableOpacity style={mediaPlayerStyle.playerControls} onPress={this.togglePlayerControls}>
{this.renderPlayerControls()} {this.renderPlayerControls()}
</TouchableOpacity> </TouchableOpacity>