diff --git a/MUXSDKStats.json b/MUXSDKStats.json index ba079acc..9bae2f6d 100644 --- a/MUXSDKStats.json +++ b/MUXSDKStats.json @@ -1,3 +1,3 @@ { - "2.10.0": "https://github.com/muxinc/mux-stats-sdk-avplayer/releases/download/v2.10.0/MUXSDKStats.xcframework.zip" + "2.11.0": "https://github.com/muxinc/mux-stats-sdk-avplayer/releases/download/v2.10.0/MUXSDKStats.xcframework.zip" } diff --git a/MUXSDKStats/MUXSDKStats.xcodeproj/project.pbxproj b/MUXSDKStats/MUXSDKStats.xcodeproj/project.pbxproj index 9f92f453..e270d77f 100644 --- a/MUXSDKStats/MUXSDKStats.xcodeproj/project.pbxproj +++ b/MUXSDKStats/MUXSDKStats.xcodeproj/project.pbxproj @@ -554,7 +554,7 @@ INFOPLIST_FILE = MUXSDKStatsTv/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 2.10.0; + MARKETING_VERSION = 2.11.0; MODULEMAP_FILE = "$(SRCROOT)/MUXSDKStatsTv/module.modulemap"; ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = com.mux.stats.tvos.MUXSDKStatsTv; @@ -581,7 +581,7 @@ INFOPLIST_FILE = MUXSDKStatsTv/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 2.10.0; + MARKETING_VERSION = 2.11.0; MODULEMAP_FILE = "$(SRCROOT)/MUXSDKStatsTv/module.modulemap"; PRODUCT_BUNDLE_IDENTIFIER = com.mux.stats.tvos.MUXSDKStatsTv; PRODUCT_NAME = MUXSDKStats; @@ -596,6 +596,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -671,6 +672,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -756,7 +758,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 2.10.0; + MARKETING_VERSION = 2.11.0; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.mux.stats.ios.MUXSDKStats; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -781,7 +783,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 2.10.0; + MARKETING_VERSION = 2.11.0; ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = com.mux.stats.ios.MUXSDKStats; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/MUXSDKStats/MUXSDKStats/MUXSDKPlayerBinding.m b/MUXSDKStats/MUXSDKStats/MUXSDKPlayerBinding.m index 527858c2..7fd36848 100644 --- a/MUXSDKStats/MUXSDKStats/MUXSDKPlayerBinding.m +++ b/MUXSDKStats/MUXSDKStats/MUXSDKPlayerBinding.m @@ -12,7 +12,7 @@ // SDK constants. NSString *const MUXSDKPluginName = @"apple-mux"; -NSString *const MUXSDKPluginVersion = @"2.10.0"; +NSString *const MUXSDKPluginVersion = @"2.11.0"; // Min number of seconds between timeupdate events. (100ms) double MUXSDKMaxSecsBetweenTimeUpdate = 0.1; @@ -195,19 +195,21 @@ - (void) handleRenditionChangeInAccessLog:(AVPlayerItemAccessLog *) log { AVPlayerItemAccessLogEvent *lastEvent = log.events.lastObject; float advertisedBitrate = lastEvent.indicatedBitrate; BOOL bitrateHasChanged = ![self doubleValueIsEqual:@(_lastAdvertisedBitrate) toOther:@(advertisedBitrate)]; - BOOL isStartingPlayback = [self doubleValueIsEqual:@(_lastAdvertisedBitrate) toOther:@(0)]; - - if (bitrateHasChanged) { - if(isStartingPlayback) { - // This is not a renditionchange but the player playing the first rendition. - _lastAdvertisedBitrate = advertisedBitrate; - return; - } - NSLog(@"MUXSDK-INFO - Switch advertised bitrate from: %f to: %f", _lastAdvertisedBitrate, advertisedBitrate); - [[NSNotificationCenter defaultCenter] postNotificationName:RenditionChangeNotification object: @{ - RenditionChangeNotificationInfoAdvertisedBitrate: @(advertisedBitrate) - }]; + if (!bitrateHasChanged) { + return; } + if (_lastAdvertisedBitrate == 0 || !_started) { + _lastAdvertisedBitrate = advertisedBitrate; + return; + } + //Dispatch rendition change event only when playback began + if (lastEvent.playbackStartDate == nil) { + return; + } + NSLog(@"MUXSDK-INFO - Switch advertised bitrate from: %f to: %f", _lastAdvertisedBitrate, advertisedBitrate); + [[NSNotificationCenter defaultCenter] postNotificationName:RenditionChangeNotification object: @{ + RenditionChangeNotificationInfoAdvertisedBitrate: @(advertisedBitrate) + }]; } - (void) calculateBandwidthMetricFromAccessLog:(AVPlayerItemAccessLog *) log { @@ -502,6 +504,7 @@ - (void)checkVideoData { } } } + if (videoDataUpdated) { MUXSDKVideoData *videoData = [[MUXSDKVideoData alloc] init]; if (_videoSize.width > 0 && _videoSize.height > 0) { @@ -522,7 +525,7 @@ - (void)checkVideoData { if (_videoURL) { [videoData setVideoSourceUrl:_videoURL]; } - if (_lastAdvertisedBitrate > 0) { + if (_lastAdvertisedBitrate > 0 && _started) { [videoData setVideoSourceAdvertisedBitrate:@(_lastAdvertisedBitrate)]; } MUXSDKDataEvent *dataEvent = [[MUXSDKDataEvent alloc] init]; diff --git a/MUXSDKStats/MUXSDKStatsTests/MUXSDKStatsTests.m b/MUXSDKStats/MUXSDKStatsTests/MUXSDKStatsTests.m index b84bd737..80f9e74e 100644 --- a/MUXSDKStats/MUXSDKStatsTests/MUXSDKStatsTests.m +++ b/MUXSDKStats/MUXSDKStatsTests/MUXSDKStatsTests.m @@ -724,6 +724,7 @@ - (void) testRenditionChangeEvent { NSString *playName = @"Player"; [MUXSDKStats monitorAVPlayerLayer:controller withPlayerName:playName customerData:customerData]; + [controller.player play]; NSDictionary *renditionInfo = @{ RenditionChangeNotificationInfoAdvertisedBitrate: @(258157) @@ -738,6 +739,7 @@ - (void) testRenditionChangeEvent { NSArray *expectedEventTypes = @[MUXSDKPlaybackEventViewInitEventType, MUXSDKDataEventType, MUXSDKPlaybackEventPlayerReadyEventType, + MUXSDKPlaybackEventPlayEventType, MUXSDKDataEventType, MUXSDKPlaybackEventRenditionChangeEventType, MUXSDKDataEventType, @@ -746,12 +748,12 @@ - (void) testRenditionChangeEvent { ]; [self assertPlayer:playName dispatchedEventTypes:expectedEventTypes]; - id event = [MUXSDKCore eventAtIndex:3 forPlayer:playName]; + id event = [MUXSDKCore eventAtIndex:4 forPlayer:playName]; MUXSDKVideoData *videoData = [((MUXSDKDataEvent *) event) videoData]; XCTAssertNotNil(videoData); XCTAssertEqualWithAccuracy(258157, [videoData.videoSourceAdvertisedBitrate doubleValue], FLT_EPSILON); - event = [MUXSDKCore eventAtIndex:5 forPlayer:playName]; + event = [MUXSDKCore eventAtIndex:6 forPlayer:playName]; videoData = [((MUXSDKDataEvent *) event) videoData]; XCTAssertNotNil(videoData); XCTAssertEqualWithAccuracy(558157, [videoData.videoSourceAdvertisedBitrate doubleValue], FLT_EPSILON); @@ -761,6 +763,7 @@ - (void) testRenditionChangeEvent { } - (void) testRenditionChangeEventsWithSameBitrate { + MuxMockAVPlayerLayer *controller = [[MuxMockAVPlayerLayer alloc] init]; MUXSDKCustomerPlayerData *customerPlayerData = [[MUXSDKCustomerPlayerData alloc] initWithEnvironmentKey:@"YOUR_COMPANY_NAME"]; MUXSDKCustomerVideoData *customerVideoData = [[MUXSDKCustomerVideoData alloc] init]; @@ -770,6 +773,7 @@ - (void) testRenditionChangeEventsWithSameBitrate { NSString *playName = @"Player"; [MUXSDKStats monitorAVPlayerLayer:controller withPlayerName:playName customerData:customerData]; + [controller.player play]; NSDictionary *renditionInfo = @{ RenditionChangeNotificationInfoAdvertisedBitrate: @(258157) @@ -784,13 +788,14 @@ - (void) testRenditionChangeEventsWithSameBitrate { NSArray *expectedEventTypes = @[MUXSDKPlaybackEventViewInitEventType, MUXSDKDataEventType, MUXSDKPlaybackEventPlayerReadyEventType, + MUXSDKPlaybackEventPlayEventType, MUXSDKDataEventType, MUXSDKPlaybackEventRenditionChangeEventType, ]; [self assertPlayer:playName dispatchedEventTypes:expectedEventTypes]; - id event = [MUXSDKCore eventAtIndex:3 forPlayer:playName]; + id event = [MUXSDKCore eventAtIndex:4 forPlayer:playName]; MUXSDKVideoData *videoData = [((MUXSDKDataEvent *) event) videoData]; XCTAssertNotNil(videoData); XCTAssertEqualWithAccuracy(258157, [videoData.videoSourceAdvertisedBitrate doubleValue], FLT_EPSILON); @@ -808,6 +813,7 @@ - (void) testOrientationAndRenditionChangeEventSequence { NSString *playName = @"Player"; [MUXSDKStats monitorAVPlayerLayer:controller withPlayerName:playName customerData:customerData]; + [controller.player play]; [MUXSDKStats orientationChangeForPlayer:playName withOrientation:MUXSDKViewOrientationPortrait]; @@ -830,6 +836,7 @@ - (void) testOrientationAndRenditionChangeEventSequence { NSArray *expectedEventTypes = @[MUXSDKPlaybackEventViewInitEventType, MUXSDKDataEventType, MUXSDKPlaybackEventPlayerReadyEventType, + MUXSDKPlaybackEventPlayEventType, MUXSDKPlaybackEventOrientationChangeEventType, MUXSDKDataEventType, MUXSDKPlaybackEventRenditionChangeEventType, @@ -843,19 +850,19 @@ - (void) testOrientationAndRenditionChangeEventSequence { [self assertPlayer:playName dispatchedDataEvents:@{ @(1): [NSNull null], - @(4): @{BANDWIDTH: @(258157)}, - @(6): @{BANDWIDTH: @(1927853)}, - @(9): @{BANDWIDTH: @(258157)}, + @(5): @{BANDWIDTH: @(258157)}, + @(7): @{BANDWIDTH: @(1927853)}, + @(10): @{BANDWIDTH: @(258157)}, }]; [self assertPlayer:playName dispatchedPlaybackEvents:@{ @(0): [NSNull null], @(2): [NSNull null], - @(3): @{X: @(0.0), Y: @(0.0), Z: @(90.0)}, - @(5): [NSNull null], - @(7): [NSNull null], - @(8): @{X: @(0.0), Y: @(0.0), Z: @(0.0)}, - @(10): [NSNull null], + @(4): @{X: @(0.0), Y: @(0.0), Z: @(90.0)}, + @(6): [NSNull null], + @(8): [NSNull null], + @(9): @{X: @(0.0), Y: @(0.0), Z: @(0.0)}, + @(11): [NSNull null], }]; [MUXSDKStats destroyPlayer:playName]; diff --git a/Mux-Stats-AVPlayer.podspec b/Mux-Stats-AVPlayer.podspec index ca9e482b..bbc00fcb 100644 --- a/Mux-Stats-AVPlayer.podspec +++ b/Mux-Stats-AVPlayer.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'Mux-Stats-AVPlayer' - s.version = '2.10.0' + s.version = '2.11.0' s.source = { :git => 'https://github.com/muxinc/mux-stats-sdk-avplayer.git', :tag => "v#{s.version}" } diff --git a/XCFramework/MUXSDKStats.xcframework/Info.plist b/XCFramework/MUXSDKStats.xcframework/Info.plist index 2aff44d3..8bb4c149 100644 --- a/XCFramework/MUXSDKStats.xcframework/Info.plist +++ b/XCFramework/MUXSDKStats.xcframework/Info.plist @@ -6,7 +6,7 @@ LibraryIdentifier - ios-arm64_x86_64-maccatalyst + tvos-arm64_x86_64-simulator LibraryPath MUXSDKStats.framework SupportedArchitectures @@ -15,37 +15,37 @@ x86_64 SupportedPlatform - ios + tvos SupportedPlatformVariant - maccatalyst + simulator LibraryIdentifier - tvos-arm64 + ios-arm64_i386_x86_64-simulator LibraryPath MUXSDKStats.framework SupportedArchitectures arm64 + i386 + x86_64 SupportedPlatform - tvos + ios + SupportedPlatformVariant + simulator LibraryIdentifier - ios-arm64_i386_x86_64-simulator + tvos-arm64 LibraryPath MUXSDKStats.framework SupportedArchitectures arm64 - i386 - x86_64 SupportedPlatform - ios - SupportedPlatformVariant - simulator + tvos LibraryIdentifier @@ -62,7 +62,7 @@ LibraryIdentifier - tvos-arm64_x86_64-simulator + ios-arm64_x86_64-maccatalyst LibraryPath MUXSDKStats.framework SupportedArchitectures @@ -71,9 +71,9 @@ x86_64 SupportedPlatform - tvos + ios SupportedPlatformVariant - simulator + maccatalyst CFBundlePackageType diff --git a/XCFramework/MUXSDKStats.xcframework/ios-arm64_armv7/MUXSDKStats.framework/Info.plist b/XCFramework/MUXSDKStats.xcframework/ios-arm64_armv7/MUXSDKStats.framework/Info.plist index a428d07f..4002b655 100644 Binary files a/XCFramework/MUXSDKStats.xcframework/ios-arm64_armv7/MUXSDKStats.framework/Info.plist and b/XCFramework/MUXSDKStats.xcframework/ios-arm64_armv7/MUXSDKStats.framework/Info.plist differ diff --git a/XCFramework/MUXSDKStats.xcframework/ios-arm64_armv7/MUXSDKStats.framework/MUXSDKStats b/XCFramework/MUXSDKStats.xcframework/ios-arm64_armv7/MUXSDKStats.framework/MUXSDKStats index 35eb4c53..4d21960a 100755 Binary files a/XCFramework/MUXSDKStats.xcframework/ios-arm64_armv7/MUXSDKStats.framework/MUXSDKStats and b/XCFramework/MUXSDKStats.xcframework/ios-arm64_armv7/MUXSDKStats.framework/MUXSDKStats differ diff --git a/XCFramework/MUXSDKStats.xcframework/ios-arm64_i386_x86_64-simulator/MUXSDKStats.framework/Info.plist b/XCFramework/MUXSDKStats.xcframework/ios-arm64_i386_x86_64-simulator/MUXSDKStats.framework/Info.plist index 0e7fff80..db915d00 100644 Binary files a/XCFramework/MUXSDKStats.xcframework/ios-arm64_i386_x86_64-simulator/MUXSDKStats.framework/Info.plist and b/XCFramework/MUXSDKStats.xcframework/ios-arm64_i386_x86_64-simulator/MUXSDKStats.framework/Info.plist differ diff --git a/XCFramework/MUXSDKStats.xcframework/ios-arm64_i386_x86_64-simulator/MUXSDKStats.framework/MUXSDKStats b/XCFramework/MUXSDKStats.xcframework/ios-arm64_i386_x86_64-simulator/MUXSDKStats.framework/MUXSDKStats index 5c8b4946..f1d45cd9 100755 Binary files a/XCFramework/MUXSDKStats.xcframework/ios-arm64_i386_x86_64-simulator/MUXSDKStats.framework/MUXSDKStats and b/XCFramework/MUXSDKStats.xcframework/ios-arm64_i386_x86_64-simulator/MUXSDKStats.framework/MUXSDKStats differ diff --git a/XCFramework/MUXSDKStats.xcframework/ios-arm64_i386_x86_64-simulator/MUXSDKStats.framework/_CodeSignature/CodeResources b/XCFramework/MUXSDKStats.xcframework/ios-arm64_i386_x86_64-simulator/MUXSDKStats.framework/_CodeSignature/CodeResources index 78ad52ad..aca0846c 100644 --- a/XCFramework/MUXSDKStats.xcframework/ios-arm64_i386_x86_64-simulator/MUXSDKStats.framework/_CodeSignature/CodeResources +++ b/XCFramework/MUXSDKStats.xcframework/ios-arm64_i386_x86_64-simulator/MUXSDKStats.framework/_CodeSignature/CodeResources @@ -14,7 +14,7 @@ Info.plist - dT+tHaPUtL5FkG9SPs31lJIhPz0= + nn/myAp5vGfA+UuOOjgzkT1Rrkc= Modules/module.modulemap diff --git a/XCFramework/MUXSDKStats.xcframework/ios-arm64_x86_64-maccatalyst/MUXSDKStats.framework/Versions/A/MUXSDKStats b/XCFramework/MUXSDKStats.xcframework/ios-arm64_x86_64-maccatalyst/MUXSDKStats.framework/Versions/A/MUXSDKStats index 2b208e86..d6ef7a37 100755 Binary files a/XCFramework/MUXSDKStats.xcframework/ios-arm64_x86_64-maccatalyst/MUXSDKStats.framework/Versions/A/MUXSDKStats and b/XCFramework/MUXSDKStats.xcframework/ios-arm64_x86_64-maccatalyst/MUXSDKStats.framework/Versions/A/MUXSDKStats differ diff --git a/XCFramework/MUXSDKStats.xcframework/ios-arm64_x86_64-maccatalyst/MUXSDKStats.framework/Versions/A/Resources/Info.plist b/XCFramework/MUXSDKStats.xcframework/ios-arm64_x86_64-maccatalyst/MUXSDKStats.framework/Versions/A/Resources/Info.plist index 91077115..3788247d 100644 --- a/XCFramework/MUXSDKStats.xcframework/ios-arm64_x86_64-maccatalyst/MUXSDKStats.framework/Versions/A/Resources/Info.plist +++ b/XCFramework/MUXSDKStats.xcframework/ios-arm64_x86_64-maccatalyst/MUXSDKStats.framework/Versions/A/Resources/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.10.0 + 2.11.0 CFBundleSupportedPlatforms MacOSX diff --git a/XCFramework/MUXSDKStats.xcframework/tvos-arm64/MUXSDKStats.framework/Info.plist b/XCFramework/MUXSDKStats.xcframework/tvos-arm64/MUXSDKStats.framework/Info.plist index 046a25a4..db4de5b8 100644 Binary files a/XCFramework/MUXSDKStats.xcframework/tvos-arm64/MUXSDKStats.framework/Info.plist and b/XCFramework/MUXSDKStats.xcframework/tvos-arm64/MUXSDKStats.framework/Info.plist differ diff --git a/XCFramework/MUXSDKStats.xcframework/tvos-arm64/MUXSDKStats.framework/MUXSDKStats b/XCFramework/MUXSDKStats.xcframework/tvos-arm64/MUXSDKStats.framework/MUXSDKStats index 5c5deecf..0987b516 100755 Binary files a/XCFramework/MUXSDKStats.xcframework/tvos-arm64/MUXSDKStats.framework/MUXSDKStats and b/XCFramework/MUXSDKStats.xcframework/tvos-arm64/MUXSDKStats.framework/MUXSDKStats differ diff --git a/XCFramework/MUXSDKStats.xcframework/tvos-arm64_x86_64-simulator/MUXSDKStats.framework/Info.plist b/XCFramework/MUXSDKStats.xcframework/tvos-arm64_x86_64-simulator/MUXSDKStats.framework/Info.plist index c840e88d..54b8ac16 100644 Binary files a/XCFramework/MUXSDKStats.xcframework/tvos-arm64_x86_64-simulator/MUXSDKStats.framework/Info.plist and b/XCFramework/MUXSDKStats.xcframework/tvos-arm64_x86_64-simulator/MUXSDKStats.framework/Info.plist differ diff --git a/XCFramework/MUXSDKStats.xcframework/tvos-arm64_x86_64-simulator/MUXSDKStats.framework/MUXSDKStats b/XCFramework/MUXSDKStats.xcframework/tvos-arm64_x86_64-simulator/MUXSDKStats.framework/MUXSDKStats index 97618995..f9f5d3d4 100755 Binary files a/XCFramework/MUXSDKStats.xcframework/tvos-arm64_x86_64-simulator/MUXSDKStats.framework/MUXSDKStats and b/XCFramework/MUXSDKStats.xcframework/tvos-arm64_x86_64-simulator/MUXSDKStats.framework/MUXSDKStats differ diff --git a/XCFramework/MUXSDKStats.xcframework/tvos-arm64_x86_64-simulator/MUXSDKStats.framework/_CodeSignature/CodeResources b/XCFramework/MUXSDKStats.xcframework/tvos-arm64_x86_64-simulator/MUXSDKStats.framework/_CodeSignature/CodeResources index e0938243..515dee8b 100644 --- a/XCFramework/MUXSDKStats.xcframework/tvos-arm64_x86_64-simulator/MUXSDKStats.framework/_CodeSignature/CodeResources +++ b/XCFramework/MUXSDKStats.xcframework/tvos-arm64_x86_64-simulator/MUXSDKStats.framework/_CodeSignature/CodeResources @@ -18,7 +18,7 @@ Info.plist - 7bV5Hi2NbfYaDMJnD6ryW/ybVqQ= + btxw62XB53GorSps1428BBp4f/Y= Modules/module.modulemap