Merge pull request #2806 from iFeelSmart/feat/add_new_events_on_tracks_changed
Feature(android): new events on tracks changed
This commit is contained in:
@@ -108,8 +108,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) => {
|
||||
@@ -132,7 +132,7 @@ class VideoPlayer extends Component {
|
||||
return x.selected
|
||||
})
|
||||
this.setState({
|
||||
audioTracks: data,
|
||||
audioTracks: data.audioTracks,
|
||||
})
|
||||
if (selectedTrack?.language) {
|
||||
this.setState({
|
||||
@@ -151,7 +151,7 @@ class VideoPlayer extends Component {
|
||||
})
|
||||
|
||||
this.setState({
|
||||
textTracks: data,
|
||||
textTracks: data.textTracks,
|
||||
})
|
||||
if (selectedTrack?.language) {
|
||||
this.setState({
|
||||
@@ -683,7 +683,6 @@ class VideoPlayer extends Component {
|
||||
}}
|
||||
>
|
||||
<Picker.Item label={'none'} value={'none'} key={'none'} />
|
||||
|
||||
{this.state.textTracks.map((track) => (
|
||||
<Picker.Item
|
||||
label={track.language}
|
||||
@@ -719,6 +718,8 @@ class VideoPlayer extends Component {
|
||||
controls={this.state.showRNVControls}
|
||||
resizeMode={this.state.resizeMode}
|
||||
onLoad={this.onLoad}
|
||||
onAudioTracks={this.onAudioTracks}
|
||||
onTextTracks={this.onTextTracks}
|
||||
onProgress={this.onProgress}
|
||||
onEnd={this.onEnd}
|
||||
progressUpdateInterval={1000}
|
||||
@@ -732,6 +733,7 @@ class VideoPlayer extends Component {
|
||||
repeat={this.state.loop}
|
||||
selectedTextTrack={this.state.selectedTextTrack}
|
||||
selectedAudioTrack={this.state.selectedAudioTrack}
|
||||
playInBackground={false}
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
)
|
||||
|
Reference in New Issue
Block a user