test(android): use new on*Tracks events in sample
This commit is contained in:
parent
63008ced42
commit
710a5b4664
@ -79,8 +79,8 @@ class VideoPlayer extends Component {
|
|||||||
|
|
||||||
onLoad = (data: any) => {
|
onLoad = (data: any) => {
|
||||||
this.setState({ duration: data.duration, loading: false, });
|
this.setState({ duration: data.duration, loading: false, });
|
||||||
this.onAudioTracks(data.audioTracks)
|
this.onAudioTracks(data)
|
||||||
this.onTextTracks(data.textTracks)
|
this.onTextTracks(data)
|
||||||
};
|
};
|
||||||
|
|
||||||
onProgress = (data: any) => {
|
onProgress = (data: any) => {
|
||||||
@ -103,7 +103,7 @@ class VideoPlayer extends Component {
|
|||||||
return x.selected
|
return x.selected
|
||||||
})
|
})
|
||||||
this.setState({
|
this.setState({
|
||||||
audioTracks: data,
|
audioTracks: data.audioTracks,
|
||||||
})
|
})
|
||||||
if (selectedTrack?.language) {
|
if (selectedTrack?.language) {
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -122,7 +122,7 @@ class VideoPlayer extends Component {
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
textTracks: data,
|
textTracks: data.textTracks,
|
||||||
})
|
})
|
||||||
if (selectedTrack?.language) {
|
if (selectedTrack?.language) {
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -622,7 +622,7 @@ class VideoPlayer extends Component {
|
|||||||
>
|
>
|
||||||
<Picker.Item label={'none'} value={'none'} key={'none'} />
|
<Picker.Item label={'none'} value={'none'} key={'none'} />
|
||||||
|
|
||||||
{this.state.textTracks.map((track) => (
|
{this.state.textTracks?.map?.((track) => (
|
||||||
<Picker.Item
|
<Picker.Item
|
||||||
label={track.language}
|
label={track.language}
|
||||||
value={track.language}
|
value={track.language}
|
||||||
@ -654,6 +654,8 @@ class VideoPlayer extends Component {
|
|||||||
muted={this.state.muted}
|
muted={this.state.muted}
|
||||||
resizeMode={this.state.resizeMode}
|
resizeMode={this.state.resizeMode}
|
||||||
onLoad={this.onLoad}
|
onLoad={this.onLoad}
|
||||||
|
onAudioTracks={this.onAudioTracks}
|
||||||
|
onTextTracks={this.onTextTracks}
|
||||||
onProgress={this.onProgress}
|
onProgress={this.onProgress}
|
||||||
onEnd={this.onEnd}
|
onEnd={this.onEnd}
|
||||||
progressUpdateInterval={1000}
|
progressUpdateInterval={1000}
|
||||||
|
Loading…
Reference in New Issue
Block a user