chore(examples/basic): minor sample fixes (#3717)

* fix(ts): onPlaybackRateChangeData was not correctly typed

* fix: ensure tracks are well displayed in the sample

* fix: fix sample style & avoid changing channel onEnd when looping is enable
This commit is contained in:
Olivier Bouillet 2024-04-26 09:42:21 +02:00 committed by GitHub
parent ce0c113a19
commit 2cd49b53fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -360,7 +360,9 @@ class VideoPlayer extends Component {
}; };
onEnd = () => { onEnd = () => {
this.channelUp(); if (!this.state.loop) {
this.channelUp();
}
}; };
onPlaybackRateChange = (data: OnPlaybackRateChangeData) => { onPlaybackRateChange = (data: OnPlaybackRateChangeData) => {
@ -593,8 +595,8 @@ class VideoPlayer extends Component {
renderTopControl() { renderTopControl() {
return ( return (
<> <View style={styles.topControlsContainer}>
<Text style={[styles.controlOption]}> <Text style={styles.controlOption}>
{this.srcList[this.state.srcListId]?.description || 'local file'} {this.srcList[this.state.srcListId]?.description || 'local file'}
</Text> </Text>
<View> <View>
@ -602,12 +604,12 @@ class VideoPlayer extends Component {
onPress={() => { onPress={() => {
this.toggleControls(); this.toggleControls();
}}> }}>
<Text style={[styles.leftRightControlOption]}> <Text style={styles.leftRightControlOption}>
{this.state.showRNVControls ? 'Hide controls' : 'Show controls'} {this.state.showRNVControls ? 'Hide controls' : 'Show controls'}
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
</> </View>
); );
} }
@ -1032,6 +1034,9 @@ const styles = StyleSheet.create({
width: 100, width: 100,
height: 40, height: 40,
}, },
}); topControlsContainer: {
paddingTop: 30,
}
});
export default VideoPlayer; export default VideoPlayer;