mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-06-03 11:16:02 +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,
|
withMediaType: .text,
|
||||||
preferredTrackID: kCMPersistentTrackID_Invalid
|
preferredTrackID: kCMPersistentTrackID_Invalid
|
||||||
) {
|
) {
|
||||||
try compositionTextTrack.insertTimeRange(
|
do {
|
||||||
CMTimeRange(start: .zero, duration: textTrack.timeRange.duration),
|
try compositionTextTrack.insertTimeRange(
|
||||||
of: textTrack,
|
CMTimeRange(start: .zero, duration: textTrack.timeRange.duration),
|
||||||
at: .zero
|
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.languageCode = textTrack.languageCode
|
||||||
compositionTextTrack.isEnabled = true
|
compositionTextTrack.isEnabled = true
|
||||||
|
|||||||
Reference in New Issue
Block a user