Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMA Ad Updates #183

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3a6062d
Update README.md
Jun 6, 2016
1264fea
Video display freeze issue fix in case the ad fails to load
SachinAhujaGit Jun 13, 2016
8fdd324
Adding a Podfile, a workspace and an initial gitignore
SachinAhujaGit Jun 13, 2016
520c259
Updating deployment target to 8.0
SachinAhujaGit Jun 13, 2016
687fac2
Updating deployment target to iOS 8.0
SachinAhujaGit Jun 13, 2016
7305a52
Updating project settings as per latest pod
SachinAhujaGit Jun 13, 2016
a86ad7a
Updating podspec
SachinAhujaGit Jun 13, 2016
0c68b1e
Updating podspec with "ObjC" flag
SachinAhujaGit Jun 13, 2016
dd170bc
Updating source in podspec
SachinAhujaGit Jun 13, 2016
7052d05
Renaming the podspec file
SachinAhujaGit Jun 13, 2016
afc4258
Adding IMA Ads delegates
SachinAhujaGit Jun 13, 2016
06f3607
Revert "Adding IMA Ads delegates"
SachinAhujaGit Jun 13, 2016
d0a819b
Adding cue points IMA Ad event type
SachinAhujaGit Jun 14, 2016
1d79f01
Loading IMA SDK latest version 3.2.1 via pods
SachinAhujaGit Jun 14, 2016
dab2dbc
Updating podspec with latest IMA SDK version
SachinAhujaGit Jun 14, 2016
2ad4e2d
Revert "Video display freeze issue fix in case the ad fails to load"
SachinAhujaGit Jun 14, 2016
6d64d24
Initiated video auto play in case the ad fails to load
SachinAhujaGit Jun 14, 2016
e50b457
Hiding the ad view before playing video
SachinAhujaGit Jun 15, 2016
78dc4c0
Posting ad state change notification
SachinAhujaGit Jun 16, 2016
695a1a4
Posting AVPlayer status failed notification
SachinAhujaGit Jun 16, 2016
c8785d4
Setting max bitrate for IMA Ads
SachinAhujaGit Jun 17, 2016
3fbb9ed
Providing player factory public access
SachinAhujaGit Jun 22, 2016
ed9f855
Video replay enabled
SachinAhujaGit Jun 22, 2016
0f87cee
Posting ad notification after video play resumed
SachinAhujaGit Jun 22, 2016
9924189
Setting google cast version in pod file/spec
SachinAhujaGit Jun 28, 2016
8eef0b5
Removing bitcode disable code from podspec
SachinAhujaGit Jul 5, 2016
a251be0
Revert "Removing bitcode disable code from podspec"
SachinAhujaGit Jul 7, 2016
c057c9a
Disabling Widevine
SachinAhujaGit Jul 25, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ xcuserdata
# Carthage/Checkouts

Carthage/Build

Pods/
Podfile.lock
.DS_Store
72 changes: 68 additions & 4 deletions KALTURAPlayerSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
BFBE8EC01C0B174400649BDF /* KPControlsView.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = BFBE8E601C0B139400649BDF /* KPControlsView.h */; };
BFBE8EC11C0B174400649BDF /* KPControlsUIWebView.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = BFBE8E5E1C0B139400649BDF /* KPControlsUIWebView.h */; };
BFBE8EC21C0B174400649BDF /* KPControlsWKWebView.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = BFBE8E621C0B139400649BDF /* KPControlsWKWebView.h */; };
EFE2C56E0569F6ABA07EFFBD /* libPods-KALTURAPlayerSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CFB27D189704B3679840E50C /* libPods-KALTURAPlayerSDK.a */; };
FB0B5AAE1C7FB3BE0067872E /* KPWidevineClassicHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = FB0B5AAD1C7FB3BE0067872E /* KPWidevineClassicHandler.m */; };
FB48BCB41C7B53E300B2E1B7 /* KPFairPlayHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = FB48BCB31C7B53E300B2E1B7 /* KPFairPlayHandler.m */; };
FB48BCB71C7C8A4800B2E1B7 /* KPAssetBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = FB48BCB61C7C8A4800B2E1B7 /* KPAssetBuilder.m */; };
Expand Down Expand Up @@ -199,9 +200,12 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
0B763B2703DBDB4330D555CB /* Pods-KALTURAPlayerSDK.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KALTURAPlayerSDK.debug.xcconfig"; path = "Pods/Target Support Files/Pods-KALTURAPlayerSDK/Pods-KALTURAPlayerSDK.debug.xcconfig"; sourceTree = "<group>"; };
0B94380941711CC7A6654CD9 /* Pods-KALTURAPlayerSDK.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KALTURAPlayerSDK.release.xcconfig"; path = "Pods/Target Support Files/Pods-KALTURAPlayerSDK/Pods-KALTURAPlayerSDK.release.xcconfig"; sourceTree = "<group>"; };
5F6879D41C271304003E5DF7 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
5F9A80181C1CCC0800DD930E /* NSDictionary+Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+Utilities.h"; sourceTree = "<group>"; };
5F9A80191C1CCC0800DD930E /* NSDictionary+Utilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+Utilities.m"; sourceTree = "<group>"; };
9E2156ADFA169243A768B874 /* libPods-KALTURAPlayerSDKResources.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-KALTURAPlayerSDKResources.a"; sourceTree = BUILT_PRODUCTS_DIR; };
B372892E1A8787D00076DD33 /* KALTURAPlayerSDKResources.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KALTURAPlayerSDKResources.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
B37289311A8787D00076DD33 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BF0394EF1CA975C90090BF66 /* Utilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Utilities.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -283,6 +287,7 @@
BFBE8E841C0B139400649BDF /* Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Utilities.h; path = KALTURAPlayerSDK/Utilities.h; sourceTree = SOURCE_ROOT; };
BFC574A41997C296000511B8 /* libWViPhoneAPI.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWViPhoneAPI.a; sourceTree = SOURCE_ROOT; };
BFFFA727182F9E31005B3B24 /* libKALTURAPlayerSDK.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKALTURAPlayerSDK.a; sourceTree = BUILT_PRODUCTS_DIR; };
CFB27D189704B3679840E50C /* libPods-KALTURAPlayerSDK.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-KALTURAPlayerSDK.a"; sourceTree = BUILT_PRODUCTS_DIR; };
FB0B5AAC1C7FB3BE0067872E /* KPWidevineClassicHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPWidevineClassicHandler.h; sourceTree = "<group>"; };
FB0B5AAD1C7FB3BE0067872E /* KPWidevineClassicHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPWidevineClassicHandler.m; sourceTree = "<group>"; };
FB48BCB21C7B53E300B2E1B7 /* KPFairPlayHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPFairPlayHandler.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -313,12 +318,31 @@
buildActionMask = 2147483647;
files = (
B3410D481A6C12E300275F00 /* libWViPhoneAPI.a in Frameworks */,
EFE2C56E0569F6ABA07EFFBD /* libPods-KALTURAPlayerSDK.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
2BB5D0748F67A5576E4AFB2F /* Pods */ = {
isa = PBXGroup;
children = (
0B763B2703DBDB4330D555CB /* Pods-KALTURAPlayerSDK.debug.xcconfig */,
0B94380941711CC7A6654CD9 /* Pods-KALTURAPlayerSDK.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
778FFEFEA9A63E802DCF7BF8 /* Frameworks */ = {
isa = PBXGroup;
children = (
CFB27D189704B3679840E50C /* libPods-KALTURAPlayerSDK.a */,
9E2156ADFA169243A768B874 /* libPods-KALTURAPlayerSDKResources.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
B30BADEE1A223142008E5E67 /* ShareStrategies */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -472,6 +496,8 @@
BFFFA72C182F9E31005B3B24 /* KALTURAPlayerSDK */,
B372892F1A8787D00076DD33 /* KPlayerResources */,
BFFFA728182F9E31005B3B24 /* Products */,
2BB5D0748F67A5576E4AFB2F /* Pods */,
778FFEFEA9A63E802DCF7BF8 /* Frameworks */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -567,10 +593,12 @@
isa = PBXNativeTarget;
buildConfigurationList = BFFFA74C182F9E31005B3B24 /* Build configuration list for PBXNativeTarget "KALTURAPlayerSDK" */;
buildPhases = (
B09DAB7EA7BD3AF43FE02EE3 /* [CP] Check Pods Manifest.lock */,
BFFFA723182F9E31005B3B24 /* Sources */,
BFFFA724182F9E31005B3B24 /* Frameworks */,
BFFFA725182F9E31005B3B24 /* CopyFiles */,
B39BEC961A0BC7510085BA26 /* Resources */,
95FDF13322A650D85620D461 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -647,6 +675,36 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
95FDF13322A650D85620D461 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-KALTURAPlayerSDK/Pods-KALTURAPlayerSDK-resources.sh\"\n";
showEnvVarsInLog = 0;
};
B09DAB7EA7BD3AF43FE02EE3 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
B3166DD41AF26C4D00E99B77 /* MultiPlatform Build */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -895,7 +953,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"\"$(SRCROOT)/WViPhoneAPI.h\"",
);
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LIBRARY_SEARCH_PATHS = (
"\"$(SRCROOT)/libWViPhoneAPI.a\"",
"\"$(SRCROOT)/libGoogleIMA3.a\"",
Expand Down Expand Up @@ -934,8 +992,8 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"\"$(SRCROOT)/WViPhoneAPI.h\"",
);
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=iphoneos*]" = 5.1.1;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=iphoneos*]" = 8.0;
LIBRARY_SEARCH_PATHS = (
"\"$(SRCROOT)/libWViPhoneAPI.a\"",
"\"$(SRCROOT)/libGoogleIMA3.a\"",
Expand All @@ -951,6 +1009,7 @@
};
BFFFA74D182F9E31005B3B24 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 0B763B2703DBDB4330D555CB /* Pods-KALTURAPlayerSDK.debug.xcconfig */;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
CLANG_CXX_LIBRARY = "compiler-default";
Expand All @@ -973,6 +1032,7 @@
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
);
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
Expand All @@ -982,6 +1042,7 @@
OTHER_LDFLAGS = (
"-ObjC",
"-all_load",
"$(inherited)",
);
PRODUCT_NAME = KALTURAPlayerSDK;
PUBLIC_HEADERS_FOLDER_PATH = "include/$(PROJECT_NAME)";
Expand All @@ -993,6 +1054,7 @@
};
BFFFA74E182F9E31005B3B24 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 0B94380941711CC7A6654CD9 /* Pods-KALTURAPlayerSDK.release.xcconfig */;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
CLANG_CXX_LIBRARY = "compiler-default";
Expand All @@ -1015,7 +1077,8 @@
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
);
"IPHONEOS_DEPLOYMENT_TARGET[sdk=iphoneos*]" = 5.1.1;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=iphoneos*]" = 8.0;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
Expand All @@ -1024,6 +1087,7 @@
OTHER_LDFLAGS = (
"-ObjC",
"-all_load",
"$(inherited)",
);
PRODUCT_NAME = KALTURAPlayerSDK;
PUBLIC_HEADERS_FOLDER_PATH = "include/$(PROJECT_NAME)";
Expand Down
10 changes: 10 additions & 0 deletions KALTURAPlayerSDK.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions KALTURAPlayerSDK/IMAHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

@property (nonatomic, strong) id webOpenerPresentingController;
@property (nonatomic, strong) id webOpenerDelegate;
@property (nonatomic, assign) int bitrate;

@end

Expand Down Expand Up @@ -117,6 +118,10 @@ typedef NS_ENUM(NSInteger, IMAAdEventType){
* Single ad has finished.
*/
kIMAAdEvent_COMPLETE,
/**
* Cuepoints changed for VOD stream (only used for dynamic ad insertion).
*/
kIMAAdEvent_CUEPOINTS_CHANGED,
/**
* First quartile of a linear ad was reached.
*/
Expand Down
23 changes: 15 additions & 8 deletions KALTURAPlayerSDK/KPAssetBuilder.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,22 @@ -(void)setAssetParam:(NSString*)key toValue:(id)value {

+(NSDictionary*)supportedMediaFormats {
// We support FairPlay and Widevine Classic, as well as clear MP4 and HLS.
return @{
#if TARGET_OS_SIMULATOR
// No DRM support in the simulator.
@"all": @[@"hls",@"mp4"],
@"drm": @[],
#else
@"all": @[@"hls",@"wvm",@"mp4"],
@"drm": @[@"hls",@"wvm"],

NSMutableArray* all = [NSMutableArray arrayWithObjects:@"hls", @"mp4", nil];
NSMutableArray* drm = [NSMutableArray array];
#if !TARGET_OS_SIMULATOR
[drm addObject:@"hls"]; // FairPlay is built-in

#if WIDEVINE_ENABLED
[drm addObject:@"wvm"]; // Widevine is optional
[all addObject:@"wvm"];
#endif

#endif

return @{
@"all": [all copy],
@"drm": [drm copy],
};
}

Expand Down
19 changes: 19 additions & 0 deletions KALTURAPlayerSDK/KPIMAPlayerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#import "KPLog.h"
#import "IMAHandler.h"

NSString * const KPAdStateDidChangeNotification = @"KPAdStateDidChangeNotification";

@interface KPIMAPlayerViewController ()

/// Contains the params for the logic layer
Expand Down Expand Up @@ -118,6 +120,7 @@ - (NSMutableDictionary *)adEventParams {
_adsRenderingSettings = [NSClassFromString(@"IMAAdsRenderingSettings") new];
_adsRenderingSettings.webOpenerPresentingController = self;
_adsRenderingSettings.webOpenerDelegate = _datasource;
_adsRenderingSettings.bitrate = 2048; // kbits
}
return _adsRenderingSettings;
}
Expand Down Expand Up @@ -173,10 +176,16 @@ - (void)adsLoader:(id<AdsLoader>)loader failedWithErrorData:(id<AdLoadingErrorDa
// Something went wrong loading ads. Log the error and play the content.
KPLogError(@"Error loading ads: %@", adErrorData.adError.message);

self.view.hidden = YES;
[self.contentPlayer play];

NSDictionary *eventParams = AdsLoadErrorKey.nullVal;
[self.delegate player:nil
eventName:eventParams.allKeys.firstObject
JSON:eventParams.allValues.firstObject];

[self postAdStateChangeNotification];

}

- (void)adsManager:(id<AdsManager>)adsManager
Expand All @@ -189,7 +198,11 @@ - (void)adsManager:(id<AdsManager>)adsManager
JSON:eventParams.allValues.firstObject];

NSLog(@"AdsManager error: %@", error.message);
self.view.hidden = YES;

[self.contentPlayer play];

[self postAdStateChangeNotification];
}

#pragma mark AdsManager Delegates
Expand All @@ -208,6 +221,7 @@ - (void)adsManager:(id<AdsManager>)adsManager

break;
case kIMAAdEvent_STARTED:
[self postAdStateChangeNotification];
self.view.hidden = NO;
self.adEventParams.duration = event.ad.duration;
eventParams = self.adEventParams.toJSON.adStart;
Expand Down Expand Up @@ -263,6 +277,7 @@ - (void)adsManagerDidRequestContentPause:(id<AdsManager>)adsManager {

- (void)adsManagerDidRequestContentResume:(id<AdsManager>)adsManager {
// The SDK is done playing ads (at least for now), so resume the content.
self.view.hidden = YES;
[self.contentPlayer play];
NSDictionary *eventParams = ContentResumeRequestedKey.nullVal;
[self.delegate player:nil
Expand Down Expand Up @@ -301,5 +316,9 @@ - (void)resume {
}
}

- (void)postAdStateChangeNotification{
[[NSNotificationCenter defaultCenter] postNotificationName:KPAdStateDidChangeNotification object:Nil];
}

@end

3 changes: 3 additions & 0 deletions KALTURAPlayerSDK/KPViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#import "KPViewControllerProtocols.h"
#import "KPPlayerConfig.h"
#import "KPController.h"
#import "KPlayerFactory.h"

@class KPViewController;
@protocol KPViewControllerDelegate <NSObject>
Expand Down Expand Up @@ -119,6 +120,8 @@

@property (nonatomic, strong) KPController *playerController;

@property (nonatomic, strong) KPlayerFactory *playerFactory;

/**
* Block which notifies that the full screen has been toggeled, when assigning to this block the default full screen behaviour will be canceled and the full screen handling will be your reponsibility.
*/
Expand Down
Loading