From b2529aa2f2881f3ae3e68095da7bb011afc9e42a Mon Sep 17 00:00:00 2001 From: Ventsislav Dimitrov Date: Thu, 25 Apr 2019 17:04:32 +0100 Subject: [PATCH] fix: adding null checks and renaming isoCode and url --- .../ReactVideoSubtitleSideloader/SubtitleTrack.swift | 4 ++-- ios/Video/RCTVideo.m | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ios/ReactVideoSubtitleSideloader/ReactVideoSubtitleSideloader/SubtitleTrack.swift b/ios/ReactVideoSubtitleSideloader/ReactVideoSubtitleSideloader/SubtitleTrack.swift index d5b1d9e84c..5cad4848e1 100644 --- a/ios/ReactVideoSubtitleSideloader/ReactVideoSubtitleSideloader/SubtitleTrack.swift +++ b/ios/ReactVideoSubtitleSideloader/ReactVideoSubtitleSideloader/SubtitleTrack.swift @@ -21,8 +21,8 @@ import Foundation } @objc public static func from(dict: NSDictionary) -> SubtitleTrack? { - guard let iso = dict["isoCode"] as? String, - let urlString = dict["url"] as? String, let url = URL(string: urlString) else { + guard let iso = dict["language"] as? String, + let urlString = dict["uri"] as? String, let url = URL(string: urlString) else { return nil } let name = diff --git a/ios/Video/RCTVideo.m b/ios/Video/RCTVideo.m index 8974526229..916bb09430 100644 --- a/ios/Video/RCTVideo.m +++ b/ios/Video/RCTVideo.m @@ -1244,12 +1244,14 @@ - (void)setMediaSelectionTrackForCharacteristic:(AVMediaCharacteristic)character } - (void)setSelectedAudioTrack:(NSDictionary *)selectedAudioTrack { + if (!selectedAudioTrack) return; _selectedAudioTrack = selectedAudioTrack; [self setMediaSelectionTrackForCharacteristic:AVMediaCharacteristicAudible withCriteria:_selectedAudioTrack]; } - (void)setSelectedTextTrack:(NSDictionary *)selectedTextTrack { + if (!selectedTextTrack) return; _selectedTextTrack = selectedTextTrack; if (_textTracks) { // sideloaded text tracks [self setSideloadedText];