diff --git a/examples/basic/src/VideoPlayer.android.tsx b/examples/basic/src/VideoPlayer.android.tsx index ef53c752..9faa9cb6 100644 --- a/examples/basic/src/VideoPlayer.android.tsx +++ b/examples/basic/src/VideoPlayer.android.tsx @@ -43,6 +43,7 @@ class VideoPlayer extends Component { selectedTextTrack: undefined, srcListId: 0, loop: false, + showRNVControls: false, }; seekerWidth = 0 @@ -258,6 +259,9 @@ class VideoPlayer extends Component { toggleFullscreen() { this.setState({ fullscreen: !this.state.fullscreen }) } + toggleControls() { + this.setState({ showRNVControls: !this.state.showRNVControls }) + } toggleDecoration() { this.setState({ decoration: !this.state.decoration }) @@ -558,118 +562,134 @@ class VideoPlayer extends Component { else return } + renderTopControl() { + return (<> + + {this.srcList[this.state.srcListId]?.description || 'local file'} + + + { + this.toggleControls() + }} + > + {this.state.showRNVControls ? 'Hide controls' : 'Show controls'} + + + ) + } + + renderOverlay() { return ( <> {this.IndicatorLoadingView()} - - {this.srcList[this.state.srcListId]?.description || 'local file'} - + {this.renderTopControl()} - - {this.renderLeftControl()} - - - {this.renderRightControl()} - - - - - {this.renderInfoControl()} - - {this.renderPause()} - - {this.renderRepeatModeControl()} - - - {this.renderFullScreenControl()} - - - {this.renderDecorationsControl()} - - - - - {this.renderRateControl(0.25)} - {this.renderRateControl(0.5)} - {this.renderRateControl(1.0)} - {this.renderRateControl(1.5)} - {this.renderRateControl(2.0)} - + {!this.state.showRNVControls ? ( + <> + + {this.renderLeftControl()} + + {this.renderRightControl()} + + + + {this.renderInfoControl()} + + {this.renderPause()} + + {this.renderRepeatModeControl()} + + + {this.renderFullScreenControl()} + + + {this.renderDecorationsControl()} + + + + + {this.renderRateControl(0.25)} + {this.renderRateControl(0.5)} + {this.renderRateControl(1.0)} + {this.renderRateControl(1.5)} + {this.renderRateControl(2.0)} + - - {this.renderVolumeControl(0.5)} - {this.renderVolumeControl(1)} - {this.renderVolumeControl(1.5)} - + + {this.renderVolumeControl(0.5)} + {this.renderVolumeControl(1)} + {this.renderVolumeControl(1.5)} + - - {this.renderResizeModeControl('cover')} - {this.renderResizeModeControl('contain')} - {this.renderResizeModeControl('stretch')} - - - {this.renderSeekBar()} - - AudioTrack - {this.state.audioTracks?.length <= 0 ? ( - empty - ) : ( - { - console.log('on audio value change ' + itemValue) - this.setState({ - selectedAudioTrack: { - type: 'language', - value: itemValue, - }, - }) - }} - > - {this.state.audioTracks.map((track) => { - return ( - - ) - })} - - )} - TextTrack - {this.state.textTracks?.length <= 0 ? ( - empty - ) : ( - { - console.log('on value change ' + itemValue) - this.setState({ - selectedTextTrack: { - type: 'language', - value: itemValue, - }, - }) - }} - > - + + {this.renderResizeModeControl('cover')} + {this.renderResizeModeControl('contain')} + {this.renderResizeModeControl('stretch')} + + + {this.renderSeekBar()} + + AudioTrack + {this.state.audioTracks?.length <= 0 ? ( + empty + ) : ( + { + console.log('on audio value change ' + itemValue); + this.setState({ + selectedAudioTrack: { + type: 'language', + value: itemValue, + }, + }); + }} + > + {this.state.audioTracks.map((track) => { + return ( + + ); + })} + + )} + TextTrack + {this.state.textTracks?.length <= 0 ? ( + empty + ) : ( + { + console.log('on value change ' + itemValue); + this.setState({ + selectedTextTrack: { + type: 'language', + value: itemValue, + }, + }); + }} + > + - {this.state.textTracks.map((track) => ( - - ))} - - )} - - + {this.state.textTracks.map((track) => ( + + ))} + + )} + + + ) : null + } ) } @@ -689,6 +709,7 @@ class VideoPlayer extends Component { paused={this.state.paused} volume={this.state.volume} muted={this.state.muted} + controls={this.state.showRNVControls} resizeMode={this.state.resizeMode} onLoad={this.onLoad} onProgress={this.onProgress}