What happened?
With controls enabled, onTextTracks and onAudioTracks report every track with
selected: false, even while a track is active (native picker or selectedTextTrack /
selectedAudioTrack). There is then no way for JS to know which track is selected: the native
picker doesn't update the controlled props, onTextTrackDataChanged only carries cue text, and
the ref exposes no getter. onLoad reports the initial selection but not later changes.
Expected: report the real selected state regardless of controls, consistent with the
controls-off path and iOS.
Root cause
In v6.15.0 onTracksChanged had no controls branch - it always used the selection-aware
getTextTrackInfo() / getAudioTrackInfo(). PR #4581 (media3 PlayerView migration, 6.16.0)
added an if (controls) branch that instead calls getBasicTextTrackInfo() /
getBasicAudioTrackInfo(), both of which hard-code setSelected(false) // ... let PlayerView handle it. onTracksChanged is the only emitter of these events, so selection is lost entirely
in that mode.
Fix
Have the basic methods compute selected via
isTrackSelected(player.getCurrentTrackSelections()...), as the controls-off methods already do.
Steps to reproduce
- Render
<Video controls /> with an HLS stream that has multiple subtitle/audio tracks.
- Change the track via the native picker.
- Log
onTextTracks / onAudioTracks - every track reports selected: false.
- With
controls={false}, the correct track is reported.
Reproduction repository
No response
react-native-video version
6.19.2
react-native version
No response
react-native-nitro-modules version
No response
Platforms
Android
OS version
No response
Device
No response
Architecture
No response
Expo
No response
Last working version
6.15.0
Media / source type
HLS (.m3u8)
What happened?
With
controlsenabled,onTextTracksandonAudioTracksreport every track withselected: false, even while a track is active (native picker orselectedTextTrack/selectedAudioTrack). There is then no way for JS to know which track is selected: the nativepicker doesn't update the controlled props,
onTextTrackDataChangedonly carries cue text, andthe ref exposes no getter.
onLoadreports the initial selection but not later changes.Expected: report the real
selectedstate regardless ofcontrols, consistent with thecontrols-off path and iOS.
Root cause
In v6.15.0
onTracksChangedhad nocontrolsbranch - it always used the selection-awaregetTextTrackInfo()/getAudioTrackInfo(). PR #4581 (media3PlayerViewmigration, 6.16.0)added an
if (controls)branch that instead callsgetBasicTextTrackInfo()/getBasicAudioTrackInfo(), both of which hard-codesetSelected(false) // ... let PlayerView handle it.onTracksChangedis the only emitter of these events, so selection is lost entirelyin that mode.
Fix
Have the basic methods compute
selectedviaisTrackSelected(player.getCurrentTrackSelections()...), as the controls-off methods already do.Steps to reproduce
<Video controls />with an HLS stream that has multiple subtitle/audio tracks.onTextTracks/onAudioTracks- every track reportsselected: false.controls={false}, the correct track is reported.Reproduction repository
No response
react-native-video version
6.19.2
react-native version
No response
react-native-nitro-modules version
No response
Platforms
Android
OS version
No response
Device
No response
Architecture
No response
Expo
No response
Last working version
6.15.0
Media / source type
HLS (.m3u8)