fix(ios): ensure we don't disable tracks when not necessary (causes black screen) (#4130)
This commit is contained in:
parent
fbe570d62f
commit
89df9d69ff
@ -15,11 +15,15 @@ enum RCTPlayerOperations {
|
|||||||
let trackCount: Int! = player?.currentItem?.tracks.count ?? 0
|
let trackCount: Int! = player?.currentItem?.tracks.count ?? 0
|
||||||
|
|
||||||
// The first few tracks will be audio & video track
|
// The first few tracks will be audio & video track
|
||||||
var firstTextIndex = 0
|
var firstTextIndex = -1
|
||||||
for i in 0 ..< trackCount where player?.currentItem?.tracks[i].assetTrack?.hasMediaCharacteristic(.legible) ?? false {
|
for i in 0 ..< trackCount where player?.currentItem?.tracks[i].assetTrack?.hasMediaCharacteristic(.legible) ?? false {
|
||||||
firstTextIndex = i
|
firstTextIndex = i
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
if firstTextIndex == -1 {
|
||||||
|
// no sideLoaded text track available (can happen with invalid vtt url)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var selectedTrackIndex: Int = RCTVideoUnset
|
var selectedTrackIndex: Int = RCTVideoUnset
|
||||||
|
|
||||||
|
@ -613,6 +613,10 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
|||||||
textTracks: self._textTracks
|
textTracks: self._textTracks
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if validTextTracks.isEmpty {
|
||||||
|
DebugLog("Strange state, not valid textTrack")
|
||||||
|
}
|
||||||
|
|
||||||
if validTextTracks.count != self._textTracks.count {
|
if validTextTracks.count != self._textTracks.count {
|
||||||
self.setTextTracks(validTextTracks)
|
self.setTextTracks(validTextTracks)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user