Skip to content

Commit

Permalink
Releases/v3.6.0 (#229)
Browse files Browse the repository at this point in the history
* feat: visionOS support

build: add SPM manifest for tools version 5.8

build: mark AVPlayerLayer APIs as unavailable on visionOS

ci: add visionOS slices to when building static multiplatform bundle

test: add visionOS test scheme

fix: set correct device category and OS family when using visionOS

* fix: cleanup leak (#234)

* build: remove duplicate test declaration
  • Loading branch information
andrewjl-mux authored Apr 10, 2024
1 parent 97eb1dc commit 18881b5
Show file tree
Hide file tree
Showing 84 changed files with 4,069 additions and 254 deletions.
5 changes: 3 additions & 2 deletions MUXSDKStats.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"2.11.0": "https://github.com/muxinc/mux-stats-sdk-avplayer/releases/download/v2.11.0/MUXSDKStats.xcframework.zip",
"2.11.0": "https://github.com/muxinc/mux-stats-sdk-avplayer/releases/download/v2.11.0/MUXSDKStats.xcframework.zip",
"2.12.0": "https://github.com/muxinc/mux-stats-sdk-avplayer/releases/download/v2.12.0/MUXSDKStats.xcframework.zip",
"2.12.1": "https://github.com/muxinc/mux-stats-sdk-avplayer/releases/download/v2.12.1/MUXSDKStats.xcframework.zip",
"2.13.0": "https://github.com/muxinc/mux-stats-sdk-avplayer/releases/download/v2.13.0/MUXSDKStats.xcframework.zip",
Expand All @@ -17,5 +17,6 @@
"3.4.1": "https://github.com/muxinc/mux-stats-sdk-avplayer/releases/download/v3.4.1/MUXSDKStats.xcframework.zip",
"3.4.2": "https://github.com/muxinc/mux-stats-sdk-avplayer/releases/download/v3.4.2/MUXSDKStats.xcframework.zip",
"3.5.0": "https://github.com/muxinc/mux-stats-sdk-avplayer/releases/download/v3.5.0/MUXSDKStats.xcframework.zip",
"3.5.1": "https://github.com/muxinc/mux-stats-sdk-avplayer/releases/download/v3.5.1/MUXSDKStats.xcframework.zip"
"3.5.1": "https://github.com/muxinc/mux-stats-sdk-avplayer/releases/download/v3.5.1/MUXSDKStats.xcframework.zip",
"3.6.0": "https://github.com/muxinc/mux-stats-sdk-avplayer/releases/download/v3.6.0/MUXSDKStats.xcframework.zip"
}
404 changes: 387 additions & 17 deletions MUXSDKStats/MUXSDKStats.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "195800DF2B51BD43008BE2EB"
BuildableName = "MUXSDKStats.framework"
BlueprintName = "MUXSDKStatsVision"
ReferencedContainer = "container:MUXSDKStats.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:MUXSDKStatsVision.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "195800DF2B51BD43008BE2EB"
BuildableName = "MUXSDKStats.framework"
BlueprintName = "MUXSDKStatsVision"
ReferencedContainer = "container:MUXSDKStats.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "19F2B24A2B68724200D5DEA6"
BuildableName = "MUXSDKStatsVisionTests.xctest"
BlueprintName = "MUXSDKStatsVisionTests"
ReferencedContainer = "container:MUXSDKStats.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
3 changes: 3 additions & 0 deletions MUXSDKStats/MUXSDKStats/MUXSDKPlayerBinding.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#import <AVFoundation/AVFoundation.h>
#if TVOS
#import <MuxCore/MuxCoreTv.h>
#elif TARGET_OS_VISION
#import <MuxCore/MuxCoreVision.h>
#else
#import <MuxCore/MuxCore.h>
#endif
Expand Down Expand Up @@ -171,6 +173,7 @@ typedef NS_ENUM(NSUInteger, MUXSDKViewOrientation) {

@end

API_UNAVAILABLE(visionos)
@interface MUXSDKAVPlayerLayerBinding : MUXSDKPlayerBinding {
@private
AVPlayerLayer *_view;
Expand Down
41 changes: 33 additions & 8 deletions MUXSDKStats/MUXSDKStats/MUXSDKPlayerBinding.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
#if __has_feature(modules)
@import Foundation;
@import CoreMedia;
@import UIKit;
#else
#import <Foundation/Foundation.h>
#import <CoreMedia/CoreMedia.h>
#import <UIKit/UIKit.h>
#endif

// SDK constants.
NSString *const MUXSDKPluginName = @"apple-mux";
NSString *const MUXSDKPluginVersion = @"3.5.1";
NSString *const MUXSDKPluginVersion = @"3.6.0";
NSString *const MUXSessionDataPrefix = @"io.litix.data.";

// Min number of seconds between timeupdate events. (100ms)
Expand Down Expand Up @@ -427,7 +429,8 @@ - (void)dispatchSessionData {
AVAsset *asset = _player.currentItem.asset;
// Load Session Data from HLS manifest
__weak MUXSDKPlayerBinding *weakSelf = self;
[asset loadValuesAsynchronouslyForKeys:@[@"metadata"]

[asset loadValuesAsynchronouslyForKeys:@[@"metadata"]
completionHandler:^{

__typeof(weakSelf) strongSelf = weakSelf;
Expand All @@ -436,6 +439,7 @@ - (void)dispatchSessionData {
}

NSMutableDictionary *sessionData = [[NSMutableDictionary alloc] init];

for (AVMetadataItem *item in asset.metadata) {
id<NSObject, NSCopying> key = [item key];
if ([key isKindOfClass:[NSString class]]) {
Expand All @@ -450,7 +454,8 @@ - (void)dispatchSessionData {
if ([sessionData count] > 0) {
MUXSDKSessionDataEvent *dataEvent = [MUXSDKSessionDataEvent new];
[dataEvent setSessionData: sessionData];
[MUXSDKCore dispatchEvent:dataEvent forPlayer:[strongSelf name]];
[MUXSDKCore dispatchEvent:dataEvent
forPlayer:[strongSelf name]];
}
}];
}
Expand Down Expand Up @@ -626,6 +631,13 @@ - (MUXSDKPlayerData *)getPlayerData {
[playerData setPlayerWidth:[NSNumber numberWithInt:viewBounds.size.width]];
[playerData setPlayerHeight:[NSNumber numberWithInt:viewBounds.size.height]];


#if TARGET_OS_VISION
// TODO: Call analogous vision OS API for the area containing
// the player window, which seems like the rough equivalent
// of UIScreen
[playerData setPlayerIsFullscreen:@"false"];
#else
CGRect screenBounds = [[UIScreen mainScreen] bounds];
// TODO: setPlayerIsFullscreen - should be a boolean.
if ((viewBounds.size.width == screenBounds.size.width && viewBounds.size.height == screenBounds.size.height) ||
Expand All @@ -634,6 +646,7 @@ - (MUXSDKPlayerData *)getPlayerData {
} else {
[playerData setPlayerIsFullscreen:@"false"];
}
#endif

// Derived from the player.
NSMutableArray *errors = [NSMutableArray new];
Expand Down Expand Up @@ -714,9 +727,13 @@ - (MUXSDKPlayerData *)getPlayerData {
}

// TODO: Airplay - don't set the view if we don't actually know what is going on.
#if TARGET_OS_VISION

#else
if (_player.externalPlaybackActive) {
[playerData setPlayerRemotePlayed:[NSNumber numberWithBool:YES]];
}
#endif
return playerData;
}

Expand Down Expand Up @@ -763,7 +780,11 @@ - (BOOL)isPlayingOrTryingToPlay {
}

- (BOOL) isPausedWhileAirPlaying {
#if TARGET_OS_VISION
return NO;
#else
return _player.externalPlaybackActive && [self isPaused];
#endif
}

- (BOOL) isAdPlaying {
Expand Down Expand Up @@ -893,12 +914,16 @@ - (void)dispatchError {
_state = MUXSDKPlayerStateError;
}

- (void) dispatchError:(nonnull NSString *)code withMessage:(nonnull NSString *)message {
[self dispatchError:code withMessage:message withErrorContext:nil];
}

- (void) dispatchError:(nonnull NSString *)code
withMessage:(nonnull NSString *)message
withMessage:(nonnull NSString *)message {
[self dispatchError:code
withMessage:message
withErrorContext:nil];
}


- (void) dispatchError:(nonnull NSString *)code
withMessage:(nonnull NSString *)message
withErrorContext:(NSString *)errorContext {
if (![self isPlayerOK]) {
return;
Expand Down
20 changes: 11 additions & 9 deletions MUXSDKStats/MUXSDKStats/MUXSDKStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#import <SystemConfiguration/SystemConfiguration.h>
#if TVOS
#import <MuxCore/MuxCoreTv.h>
#elif TARGET_OS_VISION
#import <MuxCore/MuxCoreVision.h>
#else
#import <MuxCore/MuxCore.h>
#endif
Expand Down Expand Up @@ -201,7 +203,7 @@ __attribute__((deprecated("Please migrate to monitorAVPlayerViewController:withP
*/
+ (MUXSDKPlayerBinding *_Nullable)monitorAVPlayerLayer:(nonnull AVPlayerLayer *)player
withPlayerName:(nonnull NSString *)name
customerData:(nonnull MUXSDKCustomerData *)customerData;
customerData:(nonnull MUXSDKCustomerData *)customerData API_UNAVAILABLE(visionos);

/*!
@method monitorAVPlayerLayer:withPlayerName:customerData:automaticErrorTracking:
Expand All @@ -216,7 +218,7 @@ __attribute__((deprecated("Please migrate to monitorAVPlayerViewController:withP
+ (MUXSDKPlayerBinding *_Nullable)monitorAVPlayerLayer:(nonnull AVPlayerLayer *)player
withPlayerName:(nonnull NSString *)name
customerData:(nonnull MUXSDKCustomerData *)customerData
automaticErrorTracking:(BOOL)automaticErrorTracking;
automaticErrorTracking:(BOOL)automaticErrorTracking API_UNAVAILABLE(visionos);

/*!
@method monitorAVPlayerLayer:withPlayerName:customerData:automaticErrorTracking:
Expand All @@ -233,7 +235,7 @@ __attribute__((deprecated("Please migrate to monitorAVPlayerViewController:withP
withPlayerName:(nonnull NSString *)name
customerData:(nonnull MUXSDKCustomerData *)customerData
automaticErrorTracking:(BOOL)automaticErrorTracking
beaconCollectionDomain:(nullable NSString *)collectionDomain;
beaconCollectionDomain:(nullable NSString *)collectionDomain API_UNAVAILABLE(visionos);
/*!
@method monitorAVPlayerLayer:withPlayerName:customerData:automaticErrorTracking:
@abstract Starts to monitor a given AVPlayerLayer.
Expand All @@ -250,7 +252,7 @@ __attribute__((deprecated("Please migrate to monitorAVPlayerViewController:withP
customerData:(nonnull MUXSDKCustomerData *)customerData
automaticErrorTracking:(BOOL)automaticErrorTracking
beaconDomain:(nullable NSString *)domain
__attribute__((deprecated("Please migrate to monitorAVPlayerLayer:withPlayerName:customerData:automaticErrorTracking:beaconCollectionDomain:")));
__attribute__((deprecated("Please migrate to monitorAVPlayerLayer:withPlayerName:customerData:automaticErrorTracking:beaconCollectionDomain:"))) API_UNAVAILABLE(visionos);


/*!
Expand All @@ -266,7 +268,7 @@ __attribute__((deprecated("Please migrate to monitorAVPlayerLayer:withPlayerName
+ (MUXSDKPlayerBinding *_Nullable)monitorAVPlayerLayer:(nonnull AVPlayerLayer *)player
withPlayerName:(nonnull NSString *)name
playerData:(nonnull MUXSDKCustomerPlayerData *)playerData
videoData:(nullable MUXSDKCustomerVideoData *)videoData __attribute__((deprecated("Please migrate to monitorAVPlayerLayer:withPlayerName:customerData:")));
videoData:(nullable MUXSDKCustomerVideoData *)videoData __attribute__((deprecated("Please migrate to monitorAVPlayerLayer:withPlayerName:customerData:"))) API_UNAVAILABLE(visionos);


/*!
Expand All @@ -284,7 +286,7 @@ __attribute__((deprecated("Please migrate to monitorAVPlayerLayer:withPlayerName
withPlayerName:(nonnull NSString *)name
playerData:(nonnull MUXSDKCustomerPlayerData *)playerData
videoData:(nullable MUXSDKCustomerVideoData *)videoData
viewData: (nullable MUXSDKCustomerViewData *) viewData __attribute__((deprecated("Please migrate to monitorAVPlayerLayer:withPlayerName:customerData:")));
viewData: (nullable MUXSDKCustomerViewData *) viewData __attribute__((deprecated("Please migrate to monitorAVPlayerLayer:withPlayerName:customerData:"))) API_UNAVAILABLE(visionos);


/*!
Expand All @@ -302,7 +304,7 @@ __attribute__((deprecated("Please migrate to monitorAVPlayerLayer:withPlayerName
withPlayerName:(nonnull NSString *)name
playerData:(nonnull MUXSDKCustomerPlayerData *)playerData
videoData:(nullable MUXSDKCustomerVideoData *)videoData
automaticErrorTracking:(BOOL)automaticErrorTracking __attribute__((deprecated("Please migrate to monitorAVPlayerLayer:withPlayerName:customerData:automaticErrorTracking:")));
automaticErrorTracking:(BOOL)automaticErrorTracking __attribute__((deprecated("Please migrate to monitorAVPlayerLayer:withPlayerName:customerData:automaticErrorTracking:"))) API_UNAVAILABLE(visionos);

/*!
@method monitorAVPlayerLayer:withPlayerName:playerData:videoData:viewData:automaticErrorTracking:
Expand All @@ -321,7 +323,7 @@ __attribute__((deprecated("Please migrate to monitorAVPlayerLayer:withPlayerName
playerData:(nonnull MUXSDKCustomerPlayerData *)playerData
videoData:(nullable MUXSDKCustomerVideoData *)videoData
viewData: (nullable MUXSDKCustomerViewData *) viewData
automaticErrorTracking:(BOOL)automaticErrorTracking __attribute__((deprecated("Please migrate to monitorAVPlayerLayer:withPlayerName:customerData:automaticErrorTracking:")));
automaticErrorTracking:(BOOL)automaticErrorTracking __attribute__((deprecated("Please migrate to monitorAVPlayerLayer:withPlayerName:customerData:automaticErrorTracking:"))) API_UNAVAILABLE(visionos);


/*!
Expand All @@ -332,7 +334,7 @@ __attribute__((deprecated("Please migrate to monitorAVPlayerLayer:withPlayerName
@discussion Use this method to change which AVPlayerLayer a Mux player monitor is watching. The player monitor must previously have been created via a monitorAVPlayerLayer call.
*/
+ (void)updateAVPlayerLayer:(nonnull AVPlayerLayer *)player
withPlayerName:(nonnull NSString *)name;
withPlayerName:(nonnull NSString *)name API_UNAVAILABLE(visionos);

#pragma mark - AVPlayer Monitoring

Expand Down
Loading

0 comments on commit 18881b5

Please sign in to comment.