diff --git a/Framework_DataProvider/Sources/SRGMediaPlayerController+SRGAnalytics_DataProvider.m b/Framework_DataProvider/Sources/SRGMediaPlayerController+SRGAnalytics_DataProvider.m index 964f4e2d..757c6201 100644 --- a/Framework_DataProvider/Sources/SRGMediaPlayerController+SRGAnalytics_DataProvider.m +++ b/Framework_DataProvider/Sources/SRGMediaPlayerController+SRGAnalytics_DataProvider.m @@ -48,7 +48,7 @@ - (BOOL)prepareToPlayMediaComposition:(SRGMediaComposition *)mediaComposition } NSDictionary *options = userInfo[SRGAnalyticsDataProviderUserInfoResourceLoaderOptionsKey]; - NSAssert([options isKindOfClass:NSDictionary.class], @"Resource loader options must be provided as a dictionary"); + NSAssert(! options || [options isKindOfClass:NSDictionary.class], @"Resource loader options must be provided as a dictionary"); AVURLAsset *URLAsset = nil; diff --git a/Framework_MediaPlayer/Sources/SRGMediaPlayerTracker.m b/Framework_MediaPlayer/Sources/SRGMediaPlayerTracker.m index a97cd96e..eb2fedff 100644 --- a/Framework_MediaPlayer/Sources/SRGMediaPlayerTracker.m +++ b/Framework_MediaPlayer/Sources/SRGMediaPlayerTracker.m @@ -359,9 +359,15 @@ - (NSString *)screenType - (BOOL)subtitlesEnabled { AVPlayerItem *playerItem = self.mediaPlayerController.player.currentItem; - AVMediaSelectionGroup *legibleGroup = [playerItem.asset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible]; - AVMediaSelectionOption *currentLegibleOption = [playerItem selectedMediaOptionInMediaSelectionGroup:legibleGroup]; - return currentLegibleOption != nil; + AVAsset *asset = playerItem.asset; + if ([asset statusOfValueForKey:@keypath(asset.availableMediaCharacteristicsWithMediaSelectionOptions) error:NULL] == AVKeyValueStatusLoaded) { + AVMediaSelectionGroup *legibleGroup = [playerItem.asset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible]; + AVMediaSelectionOption *currentLegibleOption = [playerItem selectedMediaOptionInMediaSelectionGroup:legibleGroup]; + return currentLegibleOption != nil; + } + else { + return NO; + } } #pragma mark Notifications diff --git a/SRGAnalytics.xcodeproj/project.pbxproj b/SRGAnalytics.xcodeproj/project.pbxproj index b324b7a4..eb0c532d 100644 --- a/SRGAnalytics.xcodeproj/project.pbxproj +++ b/SRGAnalytics.xcodeproj/project.pbxproj @@ -1797,7 +1797,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MARKETING_VERSION = 3.7.5; + MARKETING_VERSION = 3.7.6; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -1994,7 +1994,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MARKETING_VERSION = 3.7.5; + MARKETING_VERSION = 3.7.6; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; @@ -2336,7 +2336,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MARKETING_VERSION = 3.7.5; + MARKETING_VERSION = 3.7.6; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -2389,7 +2389,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MARKETING_VERSION = 3.7.5; + MARKETING_VERSION = 3.7.6; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES;