mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-05-23 15:07:45 +00:00
fix: video not loading when external subtitles are malformed (#4822)
This commit is contained in:
@@ -67,11 +67,18 @@ enum ExternalSubtitlesUtils {
|
||||
withMediaType: .text,
|
||||
preferredTrackID: kCMPersistentTrackID_Invalid
|
||||
) {
|
||||
try compositionTextTrack.insertTimeRange(
|
||||
CMTimeRange(start: .zero, duration: textTrack.timeRange.duration),
|
||||
of: textTrack,
|
||||
at: .zero
|
||||
)
|
||||
do {
|
||||
try compositionTextTrack.insertTimeRange(
|
||||
CMTimeRange(start: .zero, duration: textTrack.timeRange.duration),
|
||||
of: textTrack,
|
||||
at: .zero
|
||||
)
|
||||
} catch {
|
||||
print(
|
||||
"[ReactNativeVideo] Failed to insert text track into composition: \(error.localizedDescription). Language: \(textTrack.languageCode ?? "unknown"). Continuing without this subtitle track."
|
||||
)
|
||||
continue
|
||||
}
|
||||
|
||||
compositionTextTrack.languageCode = textTrack.languageCode
|
||||
compositionTextTrack.isEnabled = true
|
||||
|
||||
Reference in New Issue
Block a user