Skip to content

Commit

Permalink
Release v2.11.0 (#145)
Browse files Browse the repository at this point in the history
* Set Xcode build setting `APPLICATION_EXTENSION_API_ONLY = YES`
* Fix: Update rendition change logic

Co-authored-by: Audra Rodriguez [email protected] 
Co-authored-by: Stephanie Zuniga [email protected]
  • Loading branch information
StephanieZuniga authored Feb 23, 2022
1 parent ee89375 commit 994211c
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 48 deletions.
2 changes: 1 addition & 1 deletion MUXSDKStats.json
Original file line number Diff line number Diff line change
@@ -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"
}
10 changes: 6 additions & 4 deletions MUXSDKStats/MUXSDKStats.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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++";
Expand Down Expand Up @@ -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++";
Expand Down Expand Up @@ -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)";
Expand All @@ -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)";
Expand Down
31 changes: 17 additions & 14 deletions MUXSDKStats/MUXSDKStats/MUXSDKPlayerBinding.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -502,6 +504,7 @@ - (void)checkVideoData {
}
}
}

if (videoDataUpdated) {
MUXSDKVideoData *videoData = [[MUXSDKVideoData alloc] init];
if (_videoSize.width > 0 && _videoSize.height > 0) {
Expand All @@ -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];
Expand Down
29 changes: 18 additions & 11 deletions MUXSDKStats/MUXSDKStatsTests/MUXSDKStatsTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ - (void) testRenditionChangeEvent {

NSString *playName = @"Player";
[MUXSDKStats monitorAVPlayerLayer:controller withPlayerName:playName customerData:customerData];
[controller.player play];

NSDictionary *renditionInfo = @{
RenditionChangeNotificationInfoAdvertisedBitrate: @(258157)
Expand All @@ -738,6 +739,7 @@ - (void) testRenditionChangeEvent {
NSArray *expectedEventTypes = @[MUXSDKPlaybackEventViewInitEventType,
MUXSDKDataEventType,
MUXSDKPlaybackEventPlayerReadyEventType,
MUXSDKPlaybackEventPlayEventType,
MUXSDKDataEventType,
MUXSDKPlaybackEventRenditionChangeEventType,
MUXSDKDataEventType,
Expand All @@ -746,12 +748,12 @@ - (void) testRenditionChangeEvent {
];
[self assertPlayer:playName dispatchedEventTypes:expectedEventTypes];

id<MUXSDKEventTyping> event = [MUXSDKCore eventAtIndex:3 forPlayer:playName];
id<MUXSDKEventTyping> 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);
Expand All @@ -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];
Expand All @@ -770,6 +773,7 @@ - (void) testRenditionChangeEventsWithSameBitrate {

NSString *playName = @"Player";
[MUXSDKStats monitorAVPlayerLayer:controller withPlayerName:playName customerData:customerData];
[controller.player play];

NSDictionary *renditionInfo = @{
RenditionChangeNotificationInfoAdvertisedBitrate: @(258157)
Expand All @@ -784,13 +788,14 @@ - (void) testRenditionChangeEventsWithSameBitrate {
NSArray *expectedEventTypes = @[MUXSDKPlaybackEventViewInitEventType,
MUXSDKDataEventType,
MUXSDKPlaybackEventPlayerReadyEventType,
MUXSDKPlaybackEventPlayEventType,
MUXSDKDataEventType,
MUXSDKPlaybackEventRenditionChangeEventType,

];
[self assertPlayer:playName dispatchedEventTypes:expectedEventTypes];

id<MUXSDKEventTyping> event = [MUXSDKCore eventAtIndex:3 forPlayer:playName];
id<MUXSDKEventTyping> event = [MUXSDKCore eventAtIndex:4 forPlayer:playName];
MUXSDKVideoData *videoData = [((MUXSDKDataEvent *) event) videoData];
XCTAssertNotNil(videoData);
XCTAssertEqualWithAccuracy(258157, [videoData.videoSourceAdvertisedBitrate doubleValue], FLT_EPSILON);
Expand All @@ -808,6 +813,7 @@ - (void) testOrientationAndRenditionChangeEventSequence {

NSString *playName = @"Player";
[MUXSDKStats monitorAVPlayerLayer:controller withPlayerName:playName customerData:customerData];
[controller.player play];

[MUXSDKStats orientationChangeForPlayer:playName withOrientation:MUXSDKViewOrientationPortrait];

Expand All @@ -830,6 +836,7 @@ - (void) testOrientationAndRenditionChangeEventSequence {
NSArray *expectedEventTypes = @[MUXSDKPlaybackEventViewInitEventType,
MUXSDKDataEventType,
MUXSDKPlaybackEventPlayerReadyEventType,
MUXSDKPlaybackEventPlayEventType,
MUXSDKPlaybackEventOrientationChangeEventType,
MUXSDKDataEventType,
MUXSDKPlaybackEventRenditionChangeEventType,
Expand All @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion Mux-Stats-AVPlayer.podspec
Original file line number Diff line number Diff line change
@@ -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}" }

Expand Down
28 changes: 14 additions & 14 deletions XCFramework/MUXSDKStats.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<array>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-maccatalyst</string>
<string>tvos-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>MUXSDKStats.framework</string>
<key>SupportedArchitectures</key>
Expand All @@ -15,37 +15,37 @@
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<string>tvos</string>
<key>SupportedPlatformVariant</key>
<string>maccatalyst</string>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>tvos-arm64</string>
<string>ios-arm64_i386_x86_64-simulator</string>
<key>LibraryPath</key>
<string>MUXSDKStats.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>i386</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_i386_x86_64-simulator</string>
<string>tvos-arm64</string>
<key>LibraryPath</key>
<string>MUXSDKStats.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>i386</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
<string>tvos</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
Expand All @@ -62,7 +62,7 @@
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>tvos-arm64_x86_64-simulator</string>
<string>ios-arm64_x86_64-maccatalyst</string>
<key>LibraryPath</key>
<string>MUXSDKStats.framework</string>
<key>SupportedArchitectures</key>
Expand All @@ -71,9 +71,9 @@
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
<string>maccatalyst</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</data>
<key>Info.plist</key>
<data>
dT+tHaPUtL5FkG9SPs31lJIhPz0=
nn/myAp5vGfA+UuOOjgzkT1Rrkc=
</data>
<key>Modules/module.modulemap</key>
<data>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.10.0</string>
<string>2.11.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</data>
<key>Info.plist</key>
<data>
7bV5Hi2NbfYaDMJnD6ryW/ybVqQ=
btxw62XB53GorSps1428BBp4f/Y=
</data>
<key>Modules/module.modulemap</key>
<data>
Expand Down

0 comments on commit 994211c

Please sign in to comment.