test(android): use new on*Tracks events in sample

This commit is contained in:
olivier bouillet 2022-08-06 12:09:35 +02:00
parent 63008ced42
commit 710a5b4664

View File

@ -79,8 +79,8 @@ class VideoPlayer extends Component {
onLoad = (data: any) => {
this.setState({ duration: data.duration, loading: false, });
this.onAudioTracks(data.audioTracks)
this.onTextTracks(data.textTracks)
this.onAudioTracks(data)
this.onTextTracks(data)
};
onProgress = (data: any) => {
@ -103,7 +103,7 @@ class VideoPlayer extends Component {
return x.selected
})
this.setState({
audioTracks: data,
audioTracks: data.audioTracks,
})
if (selectedTrack?.language) {
this.setState({
@ -122,7 +122,7 @@ class VideoPlayer extends Component {
})
this.setState({
textTracks: data,
textTracks: data.textTracks,
})
if (selectedTrack?.language) {
this.setState({
@ -622,7 +622,7 @@ class VideoPlayer extends Component {
>
<Picker.Item label={'none'} value={'none'} key={'none'} />
{this.state.textTracks.map((track) => (
{this.state.textTracks?.map?.((track) => (
<Picker.Item
label={track.language}
value={track.language}
@ -654,6 +654,8 @@ class VideoPlayer extends Component {
muted={this.state.muted}
resizeMode={this.state.resizeMode}
onLoad={this.onLoad}
onAudioTracks={this.onAudioTracks}
onTextTracks={this.onTextTracks}
onProgress={this.onProgress}
onEnd={this.onEnd}
progressUpdateInterval={1000}