Skip to content

Commit

Permalink
Merge pull request #15 from tritondigital/ed/2.7.7
Browse files Browse the repository at this point in the history
Update to 2.7.7
  • Loading branch information
jd-buys authored Apr 23, 2024
2 parents e9c203b + ac10bfb commit a48128a
Show file tree
Hide file tree
Showing 70 changed files with 720 additions and 486 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
# Changelog
#### TritonPlayerSDK-iOS-2.7.7 - 2024-04-23
- Make Companion Banner Clickable

#### TritonPlayerSDK-iOS-2.7.6 - 2024-01-09
- Implement Timeshift
- Change podcast speed

#### TritonPlayerSDK-iOS-2.7.5 - 2024-01-09
- Location manager update

#### TritonPlayerSDK-iOS-2.7.4 - 2023-12-07
- Multi-Listener ID

#### TritonPlayerSDK-iOS-2.7.3 - 2023-09-06
- Fix Companion ads not displaying

#### TritonPlayerSDK-iOS-2.7.2 - 2022-08-16
- Add DMP Segment headers
- Expose ad duration
- Implement add countdown display on interstitial ads

#### TritonPlayerSDK-iOS-2.7.1 - 2022-03-11
- Raise a "didReceiveAnalyticsEvent" to expose the AVPlayerItemAccessLogEvent.
- Re-generate secure token on stream reconnect.
Expand Down
23 changes: 12 additions & 11 deletions TritonPlayerSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@
B4AE7A561FBBAB1C004A5615 /* Frameworks */,
);
sourceTree = "<group>";
usesTabs = 0;
};
6FFD8E2A1A07E24E003345AC /* Products */ = {
isa = PBXGroup;
Expand Down Expand Up @@ -1516,7 +1517,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "echo \"Building for iOS...\"\nxcodebuild archive \\\n -sdk iphoneos IPHONEOS_DEPLOYMENT_TARGET=11.0 \\\n -arch armv7 -arch arm64 \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n -scheme \"TritonPlayerSDK\" \\\n -archivePath \"./Framework/iphoneos/TritonPlayerSDK.xcarchive\" SKIP_INSTALL=NO\n\necho \"Building for iOS Simulator...\"\nxcodebuild archive \\\n -sdk iphonesimulator IPHONEOS_DEPLOYMENT_TARGET=11.0 \\\n -arch x86_64 -arch arm64 \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n -scheme \"TritonPlayerSDK\" \\\n -archivePath \"./Framework/iphonesimulator/TritonPlayerSDK.xcarchive\" SKIP_INSTALL=NO\n\necho \"Building XCFramework...\"\nxcodebuild -create-xcframework -output ./Framework/TritonPlayerSDK.xcframework \\\n -framework \"./Framework/iphoneos/TritonPlayerSDK.xcarchive/Products/Library/Frameworks/TritonPlayerSDK.framework\" \\\n -framework \"./Framework/iphonesimulator/TritonPlayerSDK.xcarchive/Products/Library/Frameworks/TritonPlayerSDK.framework\" \n";
shellScript = "echo \"Building for iOS...\"\nxcodebuild archive \\\n -sdk iphoneos IPHONEOS_DEPLOYMENT_TARGET=14.0 \\\n -arch armv7 -arch arm64 \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n -scheme \"TritonPlayerSDK\" \\\n -archivePath \"./Framework/iphoneos/TritonPlayerSDK.xcarchive\" SKIP_INSTALL=NO\n\necho \"Building for iOS Simulator...\"\nxcodebuild archive \\\n -sdk iphonesimulator IPHONEOS_DEPLOYMENT_TARGET=14.0 \\\n -arch x86_64 -arch arm64 \\\n BUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n -scheme \"TritonPlayerSDK\" \\\n -archivePath \"./Framework/iphonesimulator/TritonPlayerSDK.xcarchive\" SKIP_INSTALL=NO\n\necho \"Building XCFramework...\"\nxcodebuild -create-xcframework -output ./Framework/TritonPlayerSDK.xcframework \\\n -framework \"./Framework/iphoneos/TritonPlayerSDK.xcarchive/Products/Library/Frameworks/TritonPlayerSDK.framework\" \\\n -framework \"./Framework/iphonesimulator/TritonPlayerSDK.xcarchive/Products/Library/Frameworks/TritonPlayerSDK.framework\" \n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down Expand Up @@ -1673,7 +1674,7 @@
6F7FF50E1A092CB10057E4C1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = NO;
};
Expand All @@ -1682,7 +1683,7 @@
6F7FF50F1A092CB10057E4C1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = NO;
};
Expand Down Expand Up @@ -1728,7 +1729,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -1770,7 +1771,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -1796,7 +1797,7 @@
);
INFOPLIST_FILE = TritonPlayerSDK/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1828,7 +1829,7 @@
);
INFOPLIST_FILE = TritonPlayerSDK/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1860,7 +1861,7 @@
);
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = TritonPlayerSDKTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1886,7 +1887,7 @@
);
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = TritonPlayerSDKTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1913,7 +1914,7 @@
"DEBUG=1",
"$(inherited)",
);
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = TritonPlayerSDK;
Expand All @@ -1934,7 +1935,7 @@
"$(inherited)",
"$(PROJECT_DIR)",
);
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = TritonPlayerSDK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
18 changes: 9 additions & 9 deletions TritonPlayerSDK/Classes/Ads/Parser/TDAdParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ @interface TDAdParser ()<NSXMLParserDelegate>
@property (nonatomic, strong) NSMutableArray *companionBanners;
@property (nonatomic, strong) TDCompanionBanner *currentBanner;


@property (nonatomic, strong) NSString *adFormat;
@property (nonatomic, assign) NSNumber *adDuration;

@end

@implementation TDAdParser
Expand All @@ -57,8 +57,7 @@ -(void)parseFromRequestString:(NSString*)string completionBlock:(void (^)(TDAd*
self.callbackBlock = completionBlock;

NSURL *url = [NSURL URLWithString:string];
if (url) {
if ([url.scheme isEqual:@"https"] || [url.scheme isEqual:@"file"]) {
if (url && ([url.scheme isEqual:@"https"] || [url.scheme isEqual:@"file"]) ) {
// if url, donwload it and send to parser
NSMutableDictionary * headers = [NSMutableDictionary dictionary];

Expand All @@ -75,10 +74,6 @@ -(void)parseFromRequestString:(NSString*)string completionBlock:(void (^)(TDAd*

[self startParserWithData:data];
}];
} else {
self.callbackBlock(nil, [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorBadURL userInfo:@{ NSLocalizedDescriptionKey : NSLocalizedString(@"The url is invalid or is not secured.", nil) }]);
return;
}
} else {
// If inline, create data and send to parser
NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
Expand Down Expand Up @@ -134,7 +129,6 @@ -(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName name

if ([elementName isEqualToString:@"Ad"]) {
self.parsedAd = [[TDAd alloc] init];

} else if ([elementName isEqualToString:@"Error"]) {
self.parsedAd = [[TDAd alloc] init];
} else if ([elementName isEqualToString:@"CompanionAds"]) {
Expand All @@ -149,7 +143,6 @@ -(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName name

} else if ([elementName isEqualToString:@"Linear"]) {
self.currentCreativeType = kCreativeTypeLinear;

} else if ([elementName isEqualToString:@"MediaFile"] && self.parsedAd.mediaURL == nil) {
NSString *type = attributeDict[@"type"];

Expand Down Expand Up @@ -209,6 +202,9 @@ -(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namesp
}
self.currentBanner.contentURL = [NSURL URLWithString:self.stringBuffer];
}
} else if ([elementName isEqualToString:@"CompanionClickThrough"]) {
self.currentBanner.companionclickthroughURL = [NSURL URLWithString:self.stringBuffer];

} else if ([elementName isEqualToString:@"MediaFile"] && self.parsedAd.mediaURL == nil) {
if ([self.stringBuffer rangeOfString:@"https"].location == NSNotFound) {
[self.stringBuffer stringByReplacingOccurrencesOfString:@"http" withString:@"https"];
Expand All @@ -217,6 +213,7 @@ -(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namesp

} else if ([elementName isEqualToString:@"Duration"]) {
self.parsedAd.adDuration = [self secondsForTimeString:self.stringBuffer];

} else if ([elementName isEqualToString:@"ClickThrough"]) {
self.parsedAd.videoClickThroughURL = [NSURL URLWithString:self.stringBuffer];

Expand All @@ -235,6 +232,7 @@ -(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namesp
}
else if ([elementName isEqualToString:@"VASTAdTagURI"]) {
self.parsedAd.vastAdTagUri = [NSURL URLWithString:self.stringBuffer];

} else if ([elementName isEqualToString:@"Error"]){
[self.stringBuffer replaceOccurrencesOfString:@"[TD_DURATION]" withString:@"0" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [self.stringBuffer length])];
[self.stringBuffer replaceOccurrencesOfString:@"[ERRORCODE]" withString:@"202" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [self.stringBuffer length])];
Expand All @@ -250,6 +248,7 @@ -(void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock {
if ([self.currentElement isEqualToString:@"IFrameResource"] ||
[self.currentElement isEqualToString:@"HTMLResource"] ||
[self.currentElement isEqualToString:@"StaticResource"] ||
[self.currentElement isEqualToString:@"CompanionClickThrough"] ||
[self.currentElement isEqualToString:@"MediaFile"] ||
[self.currentElement isEqualToString:@"ClickThrough"] ||
[self.currentElement isEqualToString:@"Impression"] ||
Expand All @@ -269,6 +268,7 @@ -(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
if ([self.currentElement isEqualToString:@"IFrameResource"] ||
[self.currentElement isEqualToString:@"HTMLResource"] ||
[self.currentElement isEqualToString:@"StaticResource"] ||
[self.currentElement isEqualToString:@"CompanionClickThrough"] ||
[self.currentElement isEqualToString:@"MediaFile"] ||
[self.currentElement isEqualToString:@"ClickThrough"] ||
[self.currentElement isEqualToString:@"Impression"] ||
Expand Down
2 changes: 2 additions & 0 deletions TritonPlayerSDK/Classes/Ads/TDAd.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
@property (nonatomic, strong) NSURL *vastAdTagUri;

@property (nonatomic, strong) NSURL *errorUrl;

@property (nonatomic, strong) NSNumber *adDuration;

/// @name Helper methods

/**
Expand Down
1 change: 1 addition & 0 deletions TritonPlayerSDK/Classes/Ads/TDAdLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ typedef NS_ENUM(NSInteger, TDAdErrorCode) {

- (void)loadAdWithStringRequest:(NSString*)request andDmpSegments:(NSDictionary *) dmpSegments
completionHandler:(void (^) (TDAd *loadedAd, NSError *error))completionHandler;

/**
* Loads an ad asynchronously directly from a TDAdRequestURLBuilder.
*
Expand Down
4 changes: 4 additions & 0 deletions TritonPlayerSDK/Classes/Ads/TDAdLoader.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ -(void)loadAdWithStringRequest:(NSString *)request andDmpSegments:(NSDictionary

if (request) {
TDAdParser *parser = [[TDAdParser alloc] init];

if(dmpSegments){
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dmpSegments options:0 error:&error];
parser.dmpSegmentsJson = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}

[parser parseFromRequestString:request completionBlock:^(TDAd *ad, NSError *error) {

if (error) {
Expand Down Expand Up @@ -62,6 +64,7 @@ -(void)loadAdWithStringRequest:(NSString *)request andDmpSegments:(NSDictionary
[TritonSDKUtils getRequestFromURL:ad.errorUrl];
return;
}

if(mediaImpressionUrls == nil) {
mediaImpressionUrls = [[NSMutableArray alloc] init];
}
Expand Down Expand Up @@ -94,6 +97,7 @@ -(void)loadAdWithBuilder:(TDAdRequestURLBuilder *)builder
}else{
[self loadAdWithStringRequest:[builder generateAdRequestURL] completionHandler:completionHandler];
}

}

-(BOOL)isVastWrapper:(TDAd *)ad
Expand Down
1 change: 1 addition & 0 deletions TritonPlayerSDK/Classes/Ads/TDAdRequestURLBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ typedef NS_ENUM(NSInteger, TDAssetType) {
A dictionary containing the DMP Segments that will be added
*/
@property (nonatomic, strong) NSDictionary *dmpSegments;

/// @name Generating the Ad request URL

/**
Expand Down
21 changes: 11 additions & 10 deletions TritonPlayerSDK/Classes/Ads/TDBannerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -115,26 +115,27 @@ -(void)presentAd:(TDAd *)ad {
}

if (banner) {
if ( banner.contentURL ){

if( [banner.contentURL.scheme isEqualToString:@"https"] ){
[self.adWebView loadRequest:[NSURLRequest requestWithURL:banner.contentURL]];
} else {
[self failWithError:[TDAdUtils errorWithCode:TDErrorCodeInvalidAdURL andDescription:@"Only https is supported"]];
}
if (banner.contentURL) {
if ([banner.contentURL.scheme isEqualToString:@"https"]) {
NSString *htmlContent = [NSString stringWithFormat:@"<html><head><meta name=\"viewport\" content=\"width=device-width,height=device-height, initial-scale=1.0, shrink-to-fit=no\"><style type=\"text/css\">html, body {width:100%%; height: 100\%%; margin: 0px; padding: 0px;z-index:-1}</style></head><body><a href=\"%@\">\
<img src=\"%@\" alt=\"Clickable Image\" </a></body><html>", banner.companionclickthroughURL, banner.contentURL ];
[self.adWebView loadHTMLString:htmlContent baseURL:nil];
} else {
[self failWithError:[TDAdUtils errorWithCode:TDErrorCodeInvalidAdURL andDescription:@"Only https is supported"]];
}
} else if (banner.contentHTML) {
NSString *fullHTML;
NSRange rangeValue = [banner.contentHTML rangeOfString:@"<html>" options:NSCaseInsensitiveSearch];

// If we find the <html> tag in the HTMLResource CDATA we do not wrap the HTMLResource, allowing for both full HTML page as well as Snippet
if (rangeValue.location == NSNotFound )
if (rangeValue.location == NSNotFound)
fullHTML = [NSString stringWithFormat:@"<html><head><meta name=\"viewport\" content=\"width=device-width,height=device-height, initial-scale=1.0, shrink-to-fit=no\"><style type=\"text/css\">html, body {width:100%%; height: 100\%%; margin: 0px; padding: 0px;z-index:-1}</style></head><body>%@</body><html>", banner.contentHTML ];
else fullHTML = [banner.contentHTML copy];

[self.adWebView loadHTMLString: [fullHTML stringByReplacingOccurrencesOfString:@"http://" withString:@"https://"] baseURL:nil];
NSString *bodyStyle = @"document.getElementsByTagName('body')[0].style.textAlign = 'center';";
[self.adWebView evaluateJavaScript:bodyStyle completionHandler:nil];
}
}
} else {
[self failWithError:[TDAdUtils errorWithCode:TDErrorCodeNoInventory andDescription:@"No ad to display"]];
}
Expand Down
3 changes: 3 additions & 0 deletions TritonPlayerSDK/Classes/Ads/TDCompanionBanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
/// The content URL of the banner
@property (nonatomic, strong) NSURL *contentURL;

/// The redirect URL of the banner
@property (nonatomic, strong) NSURL *companionclickthroughURL;

/// The HTML content of the banner
@property (nonatomic, strong) NSString *contentHTML;

Expand Down
1 change: 1 addition & 0 deletions TritonPlayerSDK/Classes/Ads/TDInterstitialAd.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
*/

@property (nonatomic, assign) BOOL enableCountdownDisplay;

/**
* Prepare an interstitial ad for playing. It will be prefetched if needed.
*
Expand Down
2 changes: 2 additions & 0 deletions TritonPlayerSDK/Classes/Ads/TDInterstitialAdViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ - (void)playVideoAd:(TDAd *) ad {
TDCloseButton *button = [[TDCloseButton alloc] initWithFrame:CGRectMake(kCloseButtonXPosition, kCloseButtonYPosition, kCloseButtonWidth, kCloseButtonHeight)];
[button addTarget:self action:@selector(closeButtonPressed:) forControlEvents:UIControlEventTouchUpInside];


[self registerMoviePlayerNotifications];
[self presentViewController:self.moviePlayerViewController animated:YES completion:^{
[self.moviePlayerViewController.contentOverlayView addSubview:self.activityIndicator];
Expand Down Expand Up @@ -281,6 +282,7 @@ - (void)playbackStartedNotification{
if(self.enableCountdownDisplay){
self.adCountdownTimer=[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(addCountdownTimerFired) userInfo:nil repeats:YES];
}

}

- (void)registerMoviePlayerNotifications {
Expand Down
1 change: 1 addition & 0 deletions TritonPlayerSDK/Classes/Common/TritonSDKUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
+(void)downloadDataFromURL:(NSURL *)url withHeaders:(NSDictionary *)headers withCompletionHandler:(void (^)(NSData *data, NSError *error))completionHandler;

+(NSString *)getRequestFromURL:(NSURL *)url;

@end
4 changes: 2 additions & 2 deletions TritonPlayerSDK/Classes/FLVStreamPlayerLibConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// File: FLVStreamPlayerLibConstants.h
//

#define kLibVersion @"2.7.5"
#define kLibVersion @"2.7.7"

#define kMIME_TYPE_FLV @"flv" //
#define kMIME_TYPE_FLV @"flv" // maybe application/flv, video-x/flv, ...

// notification streamController => mainView
#define kNotFLVMount @"NotFLVMount"
Expand Down
Loading

0 comments on commit a48128a

Please sign in to comment.