From b8100e5b24660e675975c356d88e86b1e40e9b3a Mon Sep 17 00:00:00 2001 From: Nikolas Vasconcelos Date: Tue, 14 May 2024 08:29:11 -0300 Subject: [PATCH 1/7] WEB-2703: update google-ima lib --- ios/RNGoogleIMA.xcodeproj/project.pbxproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ios/RNGoogleIMA.xcodeproj/project.pbxproj b/ios/RNGoogleIMA.xcodeproj/project.pbxproj index 44b3550..9fa7207 100644 --- a/ios/RNGoogleIMA.xcodeproj/project.pbxproj +++ b/ios/RNGoogleIMA.xcodeproj/project.pbxproj @@ -226,12 +226,14 @@ 58B511F01A9E6C8500147676 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; HEADER_SEARCH_PATHS = ( "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../../../React/**", "$(SRCROOT)/../../react-native/React/**", ); + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LIBRARY_SEARCH_PATHS = "$(inherited)"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = RNGoogleIMA; @@ -242,12 +244,14 @@ 58B511F11A9E6C8500147676 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + "EXCLUDED_ARCHS[sdk=*]" = arm64; HEADER_SEARCH_PATHS = ( "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../../../React/**", "$(SRCROOT)/../../react-native/React/**", ); + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LIBRARY_SEARCH_PATHS = "$(inherited)"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = RNGoogleIMA; From 9d2a72d2ad7d7d2448912b44ac335c223100a78e Mon Sep 17 00:00:00 2001 From: Nikolas Vasconcelos Date: Tue, 14 May 2024 08:54:49 -0300 Subject: [PATCH 2/7] WEB-2703: exclude i386 arch from build --- ios/RNGoogleIMA.xcodeproj/project.pbxproj | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ios/RNGoogleIMA.xcodeproj/project.pbxproj b/ios/RNGoogleIMA.xcodeproj/project.pbxproj index 9fa7207..9a55623 100644 --- a/ios/RNGoogleIMA.xcodeproj/project.pbxproj +++ b/ios/RNGoogleIMA.xcodeproj/project.pbxproj @@ -226,7 +226,7 @@ 58B511F01A9E6C8500147676 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; HEADER_SEARCH_PATHS = ( "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, @@ -244,7 +244,7 @@ 58B511F11A9E6C8500147676 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - "EXCLUDED_ARCHS[sdk=*]" = arm64; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; HEADER_SEARCH_PATHS = ( "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, @@ -253,6 +253,7 @@ ); IPHONEOS_DEPLOYMENT_TARGET = 13.0; LIBRARY_SEARCH_PATHS = "$(inherited)"; + ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = RNGoogleIMA; SKIP_INSTALL = YES; From c14ce43d4a7c7a93b6e4ded2e5ef18b3f420ea18 Mon Sep 17 00:00:00 2001 From: Nikolas Vasconcelos Date: Tue, 14 May 2024 12:02:17 -0300 Subject: [PATCH 3/7] WEB-2703: update IMA version number --- RNGoogleIMA.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RNGoogleIMA.podspec b/RNGoogleIMA.podspec index a8e71f8..279888f 100644 --- a/RNGoogleIMA.podspec +++ b/RNGoogleIMA.podspec @@ -11,13 +11,13 @@ Pod::Spec.new do |s| s.license = "MIT" # s.license = { :type => "MIT", :file => "FILE_LICENSE" } s.authors = { "Sid Ferreira" => "sid@ted.com" } - s.platform = :ios, "9.0" + s.platform = :ios, "13.0" s.source = { :git => "https://github.com/tedconf/react-native-google-ima.git", :tag => "#{s.version}" } s.source_files = "ios/**/*.{h,m,swift}" s.requires_arc = true s.dependency "React" - s.dependency 'GoogleAds-IMA-iOS-SDK', '~> 3.11.2' + s.dependency 'GoogleAds-IMA-iOS-SDK', '~> 3.22.1' end From de69ef635e795d107768bac7593709dc2aa7332a Mon Sep 17 00:00:00 2001 From: Nikolas Vasconcelos Date: Tue, 14 May 2024 12:46:19 -0300 Subject: [PATCH 4/7] WEB-2703: add google ads IMA headers --- ios/GoogleInteractiveMediaAds.h | 33 ++++ ios/IMAAVPlayerContentPlayhead.h | 45 +++++ ios/IMAAVPlayerVideoDisplay.h | 96 ++++++++++ ios/IMAAd.h | 197 ++++++++++++++++++++ ios/IMAAdDisplayContainer.h | 97 ++++++++++ ios/IMAAdError.h | 179 ++++++++++++++++++ ios/IMAAdEvent.h | 175 ++++++++++++++++++ ios/IMAAdPlaybackInfo.h | 40 ++++ ios/IMAAdPodInfo.h | 66 +++++++ ios/IMAAdsLoader.h | 169 +++++++++++++++++ ios/IMAAdsManager.h | 211 ++++++++++++++++++++++ ios/IMAAdsRenderingSettings.h | 141 +++++++++++++++ ios/IMAAdsRequest.h | 200 ++++++++++++++++++++ ios/IMACompanionAd.h | 28 +++ ios/IMACompanionAdSlot.h | 111 ++++++++++++ ios/IMAContentPlayhead.h | 37 ++++ ios/IMACuepoint.h | 38 ++++ ios/IMAFriendlyObstruction.h | 45 +++++ ios/IMALiveStreamRequest.h | 73 ++++++++ ios/IMAPictureInPictureProxy.h | 70 +++++++ ios/IMAPodStreamRequest.h | 64 +++++++ ios/IMAPodVODStreamRequest.h | 59 ++++++ ios/IMASecureSignals.h | 25 +++ ios/IMASecureSignalsAdapter.h | 34 ++++ ios/IMASettings.h | 94 ++++++++++ ios/IMAStreamManager.h | 184 +++++++++++++++++++ ios/IMAStreamRequest.h | 107 +++++++++++ ios/IMAUiElements.h | 30 +++ ios/IMAUniversalAdID.h | 36 ++++ ios/IMAVODStreamRequest.h | 80 ++++++++ ios/IMAVersion.h | 14 ++ ios/IMAVideoDisplay.h | 203 +++++++++++++++++++++ ios/IMAVideoStitcherLiveStreamRequest.h | 98 ++++++++++ ios/IMAVideoStitcherVODStreamRequest.h | 105 +++++++++++ ios/RNGoogleIMA.m | 2 + ios/RNGoogleIMA.xcodeproj/project.pbxproj | 68 +++++++ 36 files changed, 3254 insertions(+) create mode 100755 ios/GoogleInteractiveMediaAds.h create mode 100755 ios/IMAAVPlayerContentPlayhead.h create mode 100755 ios/IMAAVPlayerVideoDisplay.h create mode 100755 ios/IMAAd.h create mode 100755 ios/IMAAdDisplayContainer.h create mode 100755 ios/IMAAdError.h create mode 100755 ios/IMAAdEvent.h create mode 100755 ios/IMAAdPlaybackInfo.h create mode 100755 ios/IMAAdPodInfo.h create mode 100755 ios/IMAAdsLoader.h create mode 100755 ios/IMAAdsManager.h create mode 100755 ios/IMAAdsRenderingSettings.h create mode 100755 ios/IMAAdsRequest.h create mode 100755 ios/IMACompanionAd.h create mode 100755 ios/IMACompanionAdSlot.h create mode 100755 ios/IMAContentPlayhead.h create mode 100755 ios/IMACuepoint.h create mode 100755 ios/IMAFriendlyObstruction.h create mode 100755 ios/IMALiveStreamRequest.h create mode 100755 ios/IMAPictureInPictureProxy.h create mode 100755 ios/IMAPodStreamRequest.h create mode 100755 ios/IMAPodVODStreamRequest.h create mode 100755 ios/IMASecureSignals.h create mode 100755 ios/IMASecureSignalsAdapter.h create mode 100755 ios/IMASettings.h create mode 100755 ios/IMAStreamManager.h create mode 100755 ios/IMAStreamRequest.h create mode 100755 ios/IMAUiElements.h create mode 100755 ios/IMAUniversalAdID.h create mode 100755 ios/IMAVODStreamRequest.h create mode 100755 ios/IMAVersion.h create mode 100755 ios/IMAVideoDisplay.h create mode 100755 ios/IMAVideoStitcherLiveStreamRequest.h create mode 100755 ios/IMAVideoStitcherVODStreamRequest.h diff --git a/ios/GoogleInteractiveMediaAds.h b/ios/GoogleInteractiveMediaAds.h new file mode 100755 index 0000000..699a77c --- /dev/null +++ b/ios/GoogleInteractiveMediaAds.h @@ -0,0 +1,33 @@ +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import diff --git a/ios/IMAAVPlayerContentPlayhead.h b/ios/IMAAVPlayerContentPlayhead.h new file mode 100755 index 0000000..c912bf5 --- /dev/null +++ b/ios/IMAAVPlayerContentPlayhead.h @@ -0,0 +1,45 @@ +// +// IMAAVPlayerContentPlayhead.h +// GoogleIMA3 +// +// Copyright (c) 2013 Google Inc. All rights reserved. +// +// Declares IMAAVPlayerContentPlayhead, a wrapper for tracking AVPlayer-based +// video players. + +#import + +#import "IMAContentPlayhead.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * An implementation of IMAContentPlayhead for AVPlayer. Use this class to + * provide content tracking if your content player of choice is an AVPlayer + * or its subclass. + */ +@interface IMAAVPlayerContentPlayhead : NSObject + +/** + * The player to track. + */ +@property(nonatomic, readonly) AVPlayer *player; + +/** + * Initializes a IMAAVPlayerContentPlayhead that tracks a player. It will attach a periodic time + * observer to the player immediately. + * + * @param player the AVPlayer to track. + * + * @return the IMAAVPlayerContentPlayhead instance + */ +- (instancetype)initWithAVPlayer:(AVPlayer *)player; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAAVPlayerVideoDisplay.h b/ios/IMAAVPlayerVideoDisplay.h new file mode 100755 index 0000000..b3384a7 --- /dev/null +++ b/ios/IMAAVPlayerVideoDisplay.h @@ -0,0 +1,96 @@ +// +// IMAAVPlayerVideoDisplay.h +// GoogleIMA3 +// +// Copyright (c) 2013 Google Inc. All rights reserved. +// +// Declares an object that reuses an AVPlayer for both content and ad playback + +#import + +#import "IMAVideoDisplay.h" + +NS_ASSUME_NONNULL_BEGIN + +@class AVPlayer; +@class AVPlayerItem; +@class AVURLAsset; +@class IMAAVPlayerVideoDisplay; + +/** + * The key for subtitle language. + */ +extern NSString *const kIMASubtitleLanguage; + +/** + * The key for the WebVTT sidecar subtitle URL. + */ +extern NSString *const kIMASubtitleWebVTT; + +/** + * The key for the TTML sidecar subtitle URL. + */ +extern NSString *const kIMASubtitleTTML; + +/** + * A callback protocol for IMAAVPlayerVideoDisplayDelegate. + */ +@protocol IMAAVPlayerVideoDisplayDelegate + +@optional + +/** + * Called when the IMAAVPlayerVideoDisplay will load a stream for playback. Allows the publisher to + * register the AVURLAsset for Fairplay content protection before playback starts. + * + * @param playerVideoDisplay the IMAVPlayerVideoDisplay that will load the AVURLAsset. + * @param URLAsset the AVURLAsset representing the stream to be loaded. + */ +- (void)playerVideoDisplay:(IMAAVPlayerVideoDisplay *)playerVideoDisplay + willLoadStreamAsset:(AVURLAsset *)URLAsset; + +/** + * Called when the IMAAVPlayerVideoDisplay has at least partially loaded media for + * playback and the player item is loaded. Only called for dynamic ad insertion. + */ +- (void)playerVideoDisplay:(IMAAVPlayerVideoDisplay *)playerVideoDisplay + didLoadPlayerItem:(AVPlayerItem *)playerItem; + +@end + +/** + * An implementation of the IMAVideoDisplay protocol. This object is intended + * to be initialized with the content player, and will reuse the player for + * playing ads. + */ +@interface IMAAVPlayerVideoDisplay : NSObject + +/** + * Allows the publisher to receive IMAAVPlayerVideoDisplay specific events. + */ +@property(nonatomic, weak, nullable) id playerVideoDisplayDelegate; + +/** + * The subtitles for the current stream. Will be nil until the stream starts playing. + */ +@property(nonatomic, readonly, nullable) NSArray *subtitles; + +/** + * A dictionary that contains options used to customize the initialization of an @c AVURLAsset for + * stream playback. Has no effect on client-side ads. + */ +@property(nonatomic, copy, nullable) NSDictionary *streamAssetOptions; + +/** + * Creates an IMAAVPlayerVideoDisplay that will play ads in the passed in + * content player. + * + * @param player the AVPlayer instance used for playing content + * + * @return an IMAAVPlayerVideoDisplay instance + */ +- (instancetype)initWithAVPlayer:(AVPlayer *)player; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAAd.h b/ios/IMAAd.h new file mode 100755 index 0000000..b88823e --- /dev/null +++ b/ios/IMAAd.h @@ -0,0 +1,197 @@ +// +// IMAAd.h +// GoogleIMA3 +// +// Copyright (c) 2013 Google Inc. All rights reserved. +// +// Represents metadata of a single ad. The user can use this metadata for +// positioning nonlinear ads (isLinear, width, height), internal tracking +// (adId, adTitle) or custom behavior (traffickingParameters). + +#import + +#import "IMAAdPodInfo.h" +#import "IMACompanionAd.h" +#import "IMAUniversalAdID.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Data object representing a single ad. + */ +@interface IMAAd : NSObject + +/** + * The ad ID as specified in the VAST response. + */ +@property(nonatomic, copy, readonly) NSString *adId; + +/** + * The ad title from the VAST response. + */ +@property(nonatomic, copy, readonly) NSString *adTitle; + +/** + * The ad description. + */ +@property(nonatomic, copy, readonly) NSString *adDescription; + +/** + * The source ad server information included in the ad response. + */ +@property(nonatomic, copy, readonly) NSString *adSystem; + +/** The companion ads specified in the VAST response when using DAI. Empty for client-side ads. */ +@property(nonatomic, copy, readonly) NSArray *companionAds; + +/** + * Content type of the currently selected creative. For linear creatives + * returns the content type of the currently selected media file. Returns + * empty string if no creative or media file is selected on this ad. + */ +@property(nonatomic, copy, readonly) NSString *contentType; + +/** + * The duration of the ad from the VAST response. + */ +@property(nonatomic, readonly) NSTimeInterval duration; + +/** + * The UI elements that will be displayed during ad + * playback. + */ + +@property(nonatomic, copy, readonly) NSArray *uiElements; + +/** + * Whether or not the ad UI will be disabled for this ad. + * :nodoc: + */ +@property(nonatomic, readonly, getter=isUiDisabled) BOOL uiDisabled; + +/** + * The width of the ad asset. For non-linear ads, this is the actual width + * of the ad representation. For linear ads, since they scale seamlessly, we + * currently return 0 for width. + */ +@property(nonatomic, readonly) NSInteger width; + +/** + * The height of the ad asset. For non-linear ads, this is the actual height + * of the ad representation. For linear ads, since they scale seamlessly, we + * currently return 0 for height. + */ +@property(nonatomic, readonly) NSInteger height; + +/** + * The width of the selected creative as specified in the VAST response. + */ +@property(nonatomic, readonly) NSInteger VASTMediaWidth; + +/** + * The height of the selected creative as specified in the VAST response. + */ +@property(nonatomic, readonly) NSInteger VASTMediaHeight; + +/** + * The bitrate of the selected creative as specified in the VAST response. + */ +@property(nonatomic, readonly) NSInteger VASTMediaBitrate; + +/** + * Specifies whether the ad is linear or non-linear. + */ +@property(nonatomic, readonly, getter=isLinear) BOOL linear; + +/** + * Specifies whether the ad is skippable. + */ +@property(nonatomic, readonly, getter=isSkippable) BOOL skippable; + +/** + * The number of seconds of playback before the ad becomes skippable. -1 is returned for non + * skippable ads or if this is unavailable. + */ +@property(nonatomic, readonly) NSTimeInterval skipTimeOffset; + +/** + * Set of ad podding properties. + */ +@property(nonatomic, readonly) IMAAdPodInfo *adPodInfo; + +/** + * String representing custom trafficking parameters from the VAST response. + */ +@property(nonatomic, copy, readonly) NSString *traffickingParameters; + +/** + * Returns the ID of the selected creative for the ad. + */ +@property(nonatomic, copy, readonly) NSString *creativeID; + +/** + * Returns the ISCI (Industry Standard Commercial Identifier) code for an ad. This + * is the Ad-ID of the selected creative in the VAST response. + */ +@property(nonatomic, copy, readonly) NSString *creativeAdID; + +/** + * The list of all UniversalAdIds of the selected creative for this ad. Returns an empty array if + * no universal ad IDs are found. + */ +@property(nonatomic, copy, readonly) NSArray *universalAdIDs; + +/** + * The UniversalAdId of the selected creative for the ad. Returns the id value or "unknown" + * if unavailable. + */ +@property(nonatomic, copy, readonly) + NSString *universalAdIdValue DEPRECATED_MSG_ATTRIBUTE("Use universalAdIDs instead."); + +/** + * The registry associated with cataloging the UniversalAdId of the selected creative for the ad. + * Returns the registry value, or "unknown" if unavailable. + */ +@property(nonatomic, copy, readonly) + NSString *universalAdIdRegistry DEPRECATED_MSG_ATTRIBUTE("Use universalAdIDs instead."); + +/** + * The advertiser name as defined by the serving party. + */ +@property(nonatomic, copy, readonly) NSString *advertiserName; + +/** + * Returns the URL associated with the survey for the given ad. + */ +@property(nonatomic, copy, readonly, nullable) NSString *surveyURL; + +/** + * Returns the first deal ID present in the wrapper chain for the current ad, + * starting from the top. + */ +@property(nonatomic, copy, readonly) NSString *dealID; + +/** + * The IDs of the ads, starting with the first wrapper ad. + */ +@property(nonatomic, copy, readonly) NSArray *wrapperAdIDs; + +/** + * The IDs of the ads' creatives, starting with the first wrapper ad. + */ +@property(nonatomic, copy, readonly) NSArray *wrapperCreativeIDs; + +/** + * Ad systems used for wrapper ads. The ad systems returned begin with the + * first wrapper ad and continue to each wrapper ad recursively. + */ +@property(nonatomic, copy, readonly) NSArray *wrapperSystems; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdDisplayContainer.h b/ios/IMAAdDisplayContainer.h new file mode 100755 index 0000000..cf6125b --- /dev/null +++ b/ios/IMAAdDisplayContainer.h @@ -0,0 +1,97 @@ +// +// IMAAdDisplayContainer.h +// GoogleIMA3 +// +// Copyright (c) 2014 Google Inc. All rights reserved. +// +// Declares the IMAAdDisplayContainer interface that manages the views, +// ad slots, and displays used for ad playback. + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class IMACompanionAdSlot; +@class IMAFriendlyObstruction; + +/** + * The IMAAdDisplayContainer is responsible for managing the ad container view and companion ad + * slots used for ad playback. + */ +@interface IMAAdDisplayContainer : NSObject + +/** + * View containing the video display and ad related UI. This view must be present in the view + * hierarchy in order to make ad or stream requests. + */ +@property(nonatomic, readonly) UIView *adContainer; + +/** + * View controller containing the ad container. Used to present ad UI in child view controllers. It + * must be non-nil in order to make ad or stream requests, and it must be in the view hierarchy + * before ad playback. + */ +@property(nonatomic, weak, nullable) UIViewController *adContainerViewController; + +/** The environment to focus on during an ad break. Nil if there is not currently an ad break. */ +@property(nonatomic, readonly, nullable) id focusEnvironment; + +/** List of companion ad slots. Can be nil or empty. */ +@property(nonatomic, readonly, nullable) NSArray *companionSlots; + +/** + * Initializes IMAAdDisplayContainer for rendering the ad and displaying the ad UI without any + * companion slots. + * + * @param adContainer The view where the ad will be rendered. Fills the view's bounds. + * @param adContainerViewController The view controller containing the ad container. If not provided + * here, must be set on the property before making an ads or stream request. + * + * @return A new IMAAdDisplayContainer instance + */ +- (instancetype)initWithAdContainer:(UIView *)adContainer + viewController:(nullable UIViewController *)adContainerViewController; + +/** + * Initializes IMAAdDisplayContainer for rendering the ad and displaying the ad UI. + * + * @param adContainer The view where the ad will be rendered. Fills the view's bounds. + * @param adContainerViewController The view controller containing the ad container. If not provided + * here, must be set on the property before making an ads or stream request. + * @param companionSlots The array of IMACompanionAdSlots. Can be nil or empty. + * + * @return A new IMAAdDisplayContainer instance + */ +- (instancetype)initWithAdContainer:(UIView *)adContainer + viewController:(nullable UIViewController *)adContainerViewController + companionSlots:(nullable NSArray *)companionSlots; + +/** :nodoc: */ +- (instancetype)init NS_UNAVAILABLE; + +/** + * Registers a view that overlays or obstructs this container as "friendly" for viewability + * measurement purposes. + * + * See Open Measurement + * in the IMA SDK for guidance on what is and what is not allowed to be registered. + * + * @param friendlyObstruction An obstruction to be marked as "friendly" until unregistered. + */ +- (void)registerFriendlyObstruction:(IMAFriendlyObstruction *)friendlyObstruction; + +/** Unregisters all previously registered friendly obstructions. */ +- (void)unregisterAllFriendlyObstructions; + +/** :nodoc: */ +- (void)registerVideoControlsOverlay:(UIView *)videoControlsOverlay + DEPRECATED_MSG_ATTRIBUTE("Use registerFriendlyObstruction: instead."); + +/** :nodoc: */ +- (void)unregisterAllVideoControlsOverlays DEPRECATED_MSG_ATTRIBUTE( + "Use unregisterAllFriendlyObstructions: instead."); + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdError.h b/ios/IMAAdError.h new file mode 100755 index 0000000..6d9e640 --- /dev/null +++ b/ios/IMAAdError.h @@ -0,0 +1,179 @@ +/*! \file IMAAdError.h + * GoogleIMA3 + * + * Copyright (c) 2013 Google Inc. All rights reserved. + * + * This file provides error codes that are raised by the SDK and + * declares the IMAAdError class. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +#pragma mark IMAErrorType + +/** + * Possible error types while loading or playing ads. + */ +typedef NS_ENUM(NSInteger, IMAErrorType) { + /** + * An unexpected error occurred while loading or playing the ads. + * This may mean that the SDK wasn't loaded properly. + */ + kIMAAdUnknownErrorType, + /** + * An error occurred while loading the ads. + */ + kIMAAdLoadingFailed, + /** + * An error occurred while playing the ads. + */ + kIMAAdPlayingFailed, +}; + +#pragma mark - IMAErrorCode + +/** + * Possible error codes raised while loading or playing ads. + */ +typedef NS_ENUM(NSInteger, IMAErrorCode) { + /** + * The ad response was not recognized as a valid VAST ad. + */ + kIMAError_VAST_MALFORMED_RESPONSE = 100, + /** + * Trafficking error. Video player received an ad type that it was not expecting and/or cannot + * display. + */ + kIMAError_VAST_TRAFFICKING_ERROR = 200, + /** + * The VAST URI provided, or a VAST URI provided in a subsequent Wrapper + * element, was either unavailable or reached a timeout, as defined by the + * video player. The timeout is 8 seconds for initial VAST requests and 4 + * seconds for each subsequent Wrapper. + */ + kIMAError_VAST_LOAD_TIMEOUT = 301, + /** + * The maximum number of VAST wrapper redirects has been reached. + */ + kIMAError_VAST_TOO_MANY_REDIRECTS = 302, + /** + * At least one VAST wrapper loaded and a subsequent wrapper or inline ad + * load has resulted in a 404 response code. + */ + kIMAError_VAST_INVALID_URL = 303, + /** + * There was an error playing the video ad. + */ + kIMAError_VIDEO_PLAY_ERROR = 400, + /** + * Failed to load media assets from a VAST response. + * The default timeout for media loading is 8 seconds. + */ + kIMAError_VAST_MEDIA_LOAD_TIMEOUT = 402, + /** + * Assets were found in the VAST ad response for linear ad, but none of them + * matched the video player's capabilities. + */ + kIMAError_VAST_LINEAR_ASSET_MISMATCH = 403, + /** + * A companion ad failed to load or render. + */ + kIMAError_COMPANION_AD_LOADING_FAILED = 603, + /** + * An unexpected error occurred and the cause is not known. Refer to the + * inner error for more information. + */ + kIMAError_UNKNOWN_ERROR = 900, + /** + * Ads list response was malformed. + */ + kIMAError_PLAYLIST_MALFORMED_RESPONSE = 1004, + /** + * There was a problem requesting ads from the server. + */ + kIMAError_FAILED_TO_REQUEST_ADS = 1005, + /** + * Listener for at least one of the required vast events was not added. + */ + kIMAError_REQUIRED_LISTENERS_NOT_ADDED = 1006, + /** + * No assets were found in the VAST ad response. + */ + kIMAError_VAST_ASSET_NOT_FOUND = 1007, + /** + * The ad slot is not visible on the page. + */ + kIMAError_ADSLOT_NOT_VISIBLE = 1008, + /** + * A VAST response containing a single <VAST> tag with no + * child tags. + */ + kIMAError_VAST_EMPTY_RESPONSE = 1009, + /** + * There was an error loading the ad. + */ + kIMAError_FAILED_LOADING_AD = 1010, + /** + * There was an error initializing the stream. + */ + kIMAError_STREAM_INITIALIZATION_FAILED = 1020, + /** + * Invalid arguments were provided to SDK methods. + */ + kIMAError_INVALID_ARGUMENTS = 1101, + /** + * Generic invalid usage of the API. + */ + kIMAError_API_ERROR = 1102, + /** + * The version of the runtime is too old. + */ + kIMAError_OS_RUNTIME_TOO_OLD = 1103, + /** + * Another VideoAdsManager is still using the video. It must be unloaded + * before another ad can play on the same element. + */ + kIMAError_VIDEO_ELEMENT_USED = 1201, + /** + * A video element was not specified where it was required. + */ + kIMAError_VIDEO_ELEMENT_REQUIRED = 1202, + /** + * Content playhead was not passed in, but list of ads has been returned + * from the server. + */ + kIMAError_CONTENT_PLAYHEAD_MISSING = 1205, +}; + +#pragma mark - IMAAdError + +/** + * Surfaces an error that occurred during ad loading or playing. + */ +@interface IMAAdError : NSObject + +/** + * The type of error that occurred during ad loading or ad playing. + */ +@property(nonatomic, readonly) IMAErrorType type; + +/** + * The error code for obtaining more specific information about the error. + */ +@property(nonatomic, readonly) IMAErrorCode code; + +/** + * A brief description about the error. + */ +@property(nonatomic, copy, readonly, nullable) NSString *message; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdEvent.h b/ios/IMAAdEvent.h new file mode 100755 index 0000000..22de21d --- /dev/null +++ b/ios/IMAAdEvent.h @@ -0,0 +1,175 @@ +/*! \file IMAAdEvent.h + * GoogleIMA3 + * + * Copyright (c) 2013 Google Inc. All rights reserved. + * + * Defines a data object used to convey information during ad playback. + * This object is sent to the IMAAdsManager delegate. + */ + +#import + +#import "IMAAd.h" + +NS_ASSUME_NONNULL_BEGIN + +#pragma mark IMAAdEventType + +/** + * Different event types sent by the IMAAdsManager to its delegate. + */ +typedef NS_ENUM(NSInteger, IMAAdEventType) { + /** + * Ad break ready. + */ + kIMAAdEvent_AD_BREAK_READY, + /** + * Ad break will not play back any ads. + */ + kIMAAdEvent_AD_BREAK_FETCH_ERROR, + /** + * Fired the first time each ad break ends. Applications must reenable seeking + * when this occurs (only used for dynamic ad insertion). + */ + kIMAAdEvent_AD_BREAK_ENDED, + /** + * Fired first time each ad break begins playback. If an ad break is watched + * subsequent times this will not be fired. Applications must disable seeking + * when this occurs (only used for dynamic ad insertion). + */ + kIMAAdEvent_AD_BREAK_STARTED, + /** + * Fired every time the stream switches from advertising or slate to content. + * This will be fired even when an ad is played a second time or when seeking + * into an ad (only used for dynamic ad insertion). + */ + kIMAAdEvent_AD_PERIOD_ENDED, + /** + * Fired every time the stream switches from content to advertising or slate. + * This will be fired even when an ad is played a second time or when seeking + * into an ad (only used for dynamic ad insertion). + */ + kIMAAdEvent_AD_PERIOD_STARTED, + /** + * All valid ads managed by the ads manager have completed or the ad response + * did not return any valid ads. + */ + kIMAAdEvent_ALL_ADS_COMPLETED, + /** + * Ad clicked. + */ + kIMAAdEvent_CLICKED, + /** + * Single ad has finished. + */ + kIMAAdEvent_COMPLETE, + /** + * Cuepoints changed for VOD stream (only used for dynamic ad insertion). + * For this event, the IMAAdEvent.adData property contains a list of + * IMACuepoints at IMAAdEvent.adData[@"cuepoints"]. + */ + kIMAAdEvent_CUEPOINTS_CHANGED, + /** + * The user has closed the icon fallback image dialog. This may be a good time to resume ad + * playback, which the SDK autopaused on icon tap. This event only fires for tvOS. + */ + kIMAAdEvent_ICON_FALLBACK_IMAGE_CLOSED, + /** + * The user has tapped an ad icon. On iOS, the SDK will navigate to the landing page. On tvOS, the + * SDK will present a modal dialog containing the VAST icon fallback image. + */ + kIMAAdEvent_ICON_TAPPED, + /** + * First quartile of a linear ad was reached. + */ + kIMAAdEvent_FIRST_QUARTILE, + /** + * An ad was loaded. + */ + kIMAAdEvent_LOADED, + /** + * A log event for the ads being played. These are typically non fatal errors. + */ + kIMAAdEvent_LOG, + /** + * Midpoint of a linear ad was reached. + */ + kIMAAdEvent_MIDPOINT, + /** + * Ad paused. + */ + kIMAAdEvent_PAUSE, + /** + * Ad resumed. + */ + kIMAAdEvent_RESUME, + /** + * Ad has skipped. + */ + kIMAAdEvent_SKIPPED, + /** + * Ad has started. + */ + kIMAAdEvent_STARTED, + /** + * Stream request has loaded (only used for dynamic ad insertion). + */ + kIMAAdEvent_STREAM_LOADED, + /** + * Stream has started playing (only used for dynamic ad insertion). Start + * Picture-in-Picture here if applicable. + */ + kIMAAdEvent_STREAM_STARTED, + /** + * Ad tapped. + */ + kIMAAdEvent_TAPPED, + /** + * Third quartile of a linear ad was reached. + */ + kIMAAdEvent_THIRD_QUARTILE +}; + +#pragma mark - Ad Data Keys + +/** + * The key for the time in seconds when the AD_BREAK_READY event fired. + */ +extern NSString *const kIMAAdBreakTime; + +#pragma mark - IMAAdEvent + +/** + * Simple data class used to transport ad playback information. + */ +@interface IMAAdEvent : NSObject + +/** + * Type of the event. + */ +@property(nonatomic, readonly) IMAAdEventType type; + +/** + * Stringified type of the event. + */ +@property(nonatomic, copy, readonly) NSString *typeString; + +/** + * The current ad that is playing or just played. This will be nil except for + * events where an ad is available (start, quartiles, midpoint, complete, and tap). + */ +@property(nonatomic, readonly, nullable) IMAAd *ad; + +/** + * Extra data about the ad. + */ +@property(nonatomic, copy, readonly, nullable) NSDictionary *adData; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdPlaybackInfo.h b/ios/IMAAdPlaybackInfo.h new file mode 100755 index 0000000..d7feab1 --- /dev/null +++ b/ios/IMAAdPlaybackInfo.h @@ -0,0 +1,40 @@ +// +// IMAAdPlaybackInfo.h +// GoogleIMA3 +// +// Copyright (c) 2014 Google Inc. All rights reserved. +// +// Defines a protocol for providing ad playback information. + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * Groups various properties of the ad player. + */ +@protocol IMAAdPlaybackInfo + +/** + * The current media time of the ad, or 0 if no ad loaded. + */ +@property(nonatomic, readonly) NSTimeInterval currentMediaTime; + +/** + * The total media time of the ad, or 0 if no ad loaded. + */ +@property(nonatomic, readonly) NSTimeInterval totalMediaTime; + +/** + * The buffered media time of the ad, or 0 if no ad loaded. + */ +@property(nonatomic, readonly) NSTimeInterval bufferedMediaTime; + +/** + * Whether or not the ad is currently playing. + */ +@property(nonatomic, readonly, getter=isPlaying) BOOL playing; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdPodInfo.h b/ios/IMAAdPodInfo.h new file mode 100755 index 0000000..f06cd48 --- /dev/null +++ b/ios/IMAAdPodInfo.h @@ -0,0 +1,66 @@ +// +// IMAAdPodInfo.h +// GoogleIMA3 +// +// Copyright (c) 2013 Google Inc. All rights reserved. +// +// Represents podding metadata for a single ad. + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * Simple data object containing podding metadata. + */ +@interface IMAAdPodInfo : NSObject + +/** + * Total number of ads in the pod this ad belongs to. Will be 1 for standalone ads. + */ +@property(nonatomic, readonly) NSInteger totalAds; + +/** + * The position of this ad within an ad pod. Will be 1 for standalone ads. + */ +@property(nonatomic, readonly) NSInteger adPosition; + +/** + * Specifies whether the ad is a bumper. Bumpers are short videos used to open + * and close ad breaks. + */ +@property(nonatomic, readonly) BOOL isBumper; + +/** + * Client side: Returns the index of the ad pod. For a preroll pod, returns 0. + * For midrolls, returns 1, 2,..., N. For a postroll pod, returns -1. Defaults + * to 0 if this ad is not part of a pod, or this pod is not part of a playlist. + * DAI live stream: Returns the index of the ad pod. For a preroll pod, returns + * 0. For midrolls, returns the break ID. Returns -2 if pod index cannot be + * determined (internal error). + * DAI VOD: Returns the index of the ad pod. For a preroll pod, returns 0. For + * midrolls, returns 1, 2,...,N. For a postroll pod, returns N+1...N+X. + * Defaults to 0 if this ad is not part of a pod, or this pod is not part of a + * playlist. + */ +@property(nonatomic, readonly) NSInteger podIndex; + +/** + * The position of the pod in the content in seconds. Pre-roll returns 0, + * post-roll returns -1 and mid-rolls return the scheduled time of the pod. + */ +@property(nonatomic, readonly) NSTimeInterval timeOffset; + +/** + * The maximum duration of the pod in seconds. For unknown duration, -1 is returned. + */ +@property(nonatomic, readonly) NSTimeInterval maxDuration; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdsLoader.h b/ios/IMAAdsLoader.h new file mode 100755 index 0000000..0ebc318 --- /dev/null +++ b/ios/IMAAdsLoader.h @@ -0,0 +1,169 @@ +// +// IMAAdsLoader.h +// GoogleIMA3 +// +// Copyright (c) 2013 Google Inc. All rights reserved. +// +// Declares a set of classes used when loading ads. + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class IMAAdError; +@class IMAAdsLoader; +@class IMAAdsManager; +@class IMAStreamManager; +@class IMAAdsRequest; +@class IMAStreamRequest; +@class IMASettings; + +#pragma mark - IMAAdsLoadedData + +/** + * Ad data that is returned when the ads loader loads the ad. + */ +@interface IMAAdsLoadedData : NSObject + +/** + * The ads manager instance created by the ads loader. + * Will be nil when using dynamic ad insertion. + */ +@property(nonatomic, readonly, nullable) IMAAdsManager *adsManager; + +/** + * The stream manager instance created by the ads loader. + * Will be nil when requesting ads client side. + */ +@property(nonatomic, readonly, nullable) IMAStreamManager *streamManager; + +/** + * The user context specified in the ads request. + */ +@property(nonatomic, readonly, nullable) id userContext; + +@end + +#pragma mark - IMAAdLoadingErrorData + +/** + * Ad error data that is returned when the ads loader fails to load the ad. + */ +@interface IMAAdLoadingErrorData : NSObject + +/** + * The ad error that occurred while loading the ad. + */ +@property(nonatomic, readonly) IMAAdError *adError; + +/** + * The user context specified in the ads request. + */ +@property(nonatomic, readonly, nullable) id userContext; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +#pragma mark - IMAAdsLoaderDelegate + +/** + * Delegate object that receives state change callbacks from IMAAdsLoader. + */ +@protocol IMAAdsLoaderDelegate + +/** + * Called when ads are successfully loaded from the ad servers by the loader. + * + * @param loader the IMAAdsLoader that received the loaded ad data + * @param adsLoadedData the IMAAdsLoadedData instance containing ad data + */ +- (void)adsLoader:(IMAAdsLoader *)loader adsLoadedWithData:(IMAAdsLoadedData *)adsLoadedData; + +/** + * Error reported by the ads loader when loading or requesting an ad fails. + * + * @param loader the IMAAdsLoader that received the error + * @param adErrorData the IMAAdLoadingErrorData instance with error information + */ +- (void)adsLoader:(IMAAdsLoader *)loader failedWithErrorData:(IMAAdLoadingErrorData *)adErrorData; + +@end + +#pragma mark - IMAAdsLoader + +/** + * The IMAAdsLoader class allows the requesting of ads from the ad server. + * Use the delegate to receive the loaded ads or loading error + * in case of failure. + */ +@interface IMAAdsLoader : NSObject + +/** + * SDK-wide settings. Note that certain settings will only be evaluated during initialization of + * the adsLoader. + */ +@property(nonatomic, copy, readonly) IMASettings *settings; + +/** + * Delegate that receives IMAAdsLoaderDelegate callbacks. + */ +@property(nonatomic, weak, nullable) id delegate; + +/** + * Returns the SDK version. + * + * @return the SDK version + */ ++ (NSString *)sdkVersion; + +/** + * Initializes an IMAAdsLoader with specific settings. The loader takes 1-2 seconds to setup once + * initialized, therefore reusing a single instance of the ads loader is encouraged to minimize ad + * request times. + * + * @param settings the IMASettings to use for SDK wide settings. Uses defaults when nil. + * + * @return an IMAAdsLoader instance with given IMASettings + */ +- (instancetype)initWithSettings:(nullable IMASettings *)settings; + +/** + * Initializes the IMAAdsLoader with default settings. The loader takes 1-2 seconds to setup once + * initialized, therefore reusing a single instance of the ads loader is encouraged to minimize ad + * request times. + * + * @return an IMAAdsLoader instance with default IMASettings + */ +- (instancetype)init; + +/** + * Request ads from the ad server. The loader takes 1-2 seconds to setup on init and become ready + * to make ad requests. So reusing the same IMAAdsLoader instance is encouraged when making ad + * requests in order to minimize ad request times. + * + * @param request the IMAAdsRequest. If it was created for use with Picture-in-Picture, this + * IMAAdsLoader instance's IMASettings must have backround playback enabled + */ +- (void)requestAdsWithRequest:(IMAAdsRequest *)request; + +/** + * Request a stream with ads inserted dynamically. Reusing the same IMAAdsLoader instance is + * encouraged when making stream requests in order to minimize stream request latency. + * + * @param request the stream request + */ +- (void)requestStreamWithRequest:(IMAStreamRequest *)request; + +/** + * Signal to the SDK that the content has completed. The SDK will play + * post-rolls at this time, if any are scheduled. + */ +- (void)contentComplete; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdsManager.h b/ios/IMAAdsManager.h new file mode 100755 index 0000000..518ddb1 --- /dev/null +++ b/ios/IMAAdsManager.h @@ -0,0 +1,211 @@ +// +// IMAAdsManager.h +// GoogleIMA3 +// +// Copyright (c) 2013 Google Inc. All rights reserved. +// +// Declares IMAAdsManager interface that manages ad playback. +// The interface represents an abstract API. There can be one or more ads +// managed by a single ads manager. +// The implementing code should respond to the callbacks as defined in +// IMAAdsManagerDelegate. +// +// A typical ad playback session: +// 1. Ads manager is retrieved. Delegate is set. +// 2. [adsManager initialize...]; - ad is initialized and loads. +// 3. delegate.didReceiveAdEvent is called with a kIMAAdEventLoaded event. +// 4. [adsManager start]; +// 5. delegate.adsManagerDidRequestContentPause: is called. The content +// playback should pause now. +// 6. Ad display container main view is unhidden and playback starts. +// 7. delegate.didReceiveAdEvent is called with ad events. +// 8. Ad finishes. +// 9. delegate.adsManagerDidRequestContentResume: is called. The content +// playback should resume now. +// 10. delegate.didReceiveAdEvent: is called with the +// kIMAAdEvent_ALL_ADS_COMPLETED event. +// It is possible to detach the delegate and destroy the ads manager. +// +// If multiple ads are managed by the ads manager, steps 5-9 may repeat several +// times. Step 5 will happen at times predetermined by the ads server. +// The implementing code should listen to callbacks until +// kIMAAdEvent_ALL_ADS_COMPLETED is received. + +#import + +@class IMAAdDisplayContainer; +@class IMAAdError; +@class IMAAdEvent; +@class IMAAdsRenderingSettings; + +#import "IMAAdPlaybackInfo.h" +#import "IMAContentPlayhead.h" + +NS_ASSUME_NONNULL_BEGIN + +@class IMAAdsManager; + +#pragma mark IMAAdsManagerDelegate + +/** + * A callback protocol for IMAAdsManager. + */ +@protocol IMAAdsManagerDelegate + +/** + * Called when there is an IMAAdEvent. + * + * @param adsManager the IMAAdsManager receiving the event + * @param event the IMAAdEvent received + */ +- (void)adsManager:(IMAAdsManager *)adsManager didReceiveAdEvent:(IMAAdEvent *)event; + +/** + * Called when there was an error playing the ad. + * Log the error and resume playing content. + * + * @param adsManager the IMAAdsManager that errored + * @param error the IMAAdError received + */ +- (void)adsManager:(IMAAdsManager *)adsManager didReceiveAdError:(IMAAdError *)error; + +/** + * Called when an ad is ready to play. + * The implementing code should pause the content playback and prepare the UI + * for ad playback. + * + * @param adsManager the IMAAdsManager requesting content pause + */ +- (void)adsManagerDidRequestContentPause:(IMAAdsManager *)adsManager; + +/** + * Called when an ad has finished or an error occurred during the playback. + * The implementing code should resume the content playback. + * + * @param adsManager the IMAAdsManager requesting content resume + */ +- (void)adsManagerDidRequestContentResume:(IMAAdsManager *)adsManager; + +@optional + +/** + * Called every 200ms to provide time updates for the current ad. + * + * @param adsManager the IMAAdsManager tracking ad playback + * @param mediaTime the current media time in seconds + * @param totalTime the total media length in seconds + */ +- (void)adsManager:(IMAAdsManager *)adsManager + adDidProgressToTime:(NSTimeInterval)mediaTime + totalTime:(NSTimeInterval)totalTime; + +/** + * Called when the current ad is sufficiently buffered and playback is likely + * to keep up. + * + * @param adsManager the IMAAdsManager with ad playback ready + */ +- (void)adsManagerAdPlaybackReady:(IMAAdsManager *)adsManager; + +/** + * Called when the current ad media buffer is empty and playback did stall. + * + * @param adsManager the IMAAdsManager tracking the stalled ad + */ +- (void)adsManagerAdDidStartBuffering:(IMAAdsManager *)adsManager; + +/** + * Called as the current ad media buffers. + * + * @param adsManager the IMAAdsManager tracking the ad's media buffer + * @param mediaTime the current buffered media time in seconds + */ +- (void)adsManager:(IMAAdsManager *)adsManager adDidBufferToMediaTime:(NSTimeInterval)mediaTime; + +@end + +#pragma mark - IMAAdsManager + +/** + * The IMAAdsManager class is responsible for playing ads. + */ +@interface IMAAdsManager : NSObject + +/** + * The IMAAdsManagerDelegate to notify with events during ad playback. + */ +@property(nonatomic, weak, nullable) NSObject *delegate; + +/** + * List of content time offsets at which ad breaks are scheduled. + * Array of NSNumber double values in seconds. + * Empty NSArray for single ads or if no ad breaks are scheduled. + */ +@property(nonatomic, copy, readonly) NSArray *adCuePoints; + +/** + * Groups various properties about the linear ad playback. + */ +@property(nonatomic, readonly) id adPlaybackInfo; + +/** + * Set and get the volume for the current ad. From 0 (muted) to 1 (loudest). This volume is + * relative to device volume, not absolute. Default value is 1. + */ +@property(nonatomic, assign) float volume; + +/** + * Initializes and loads the ad. + * + * @param adsRenderingSettings the IMAAdsRenderingSettings. Pass in to influence ad rendering. + * Use nil to default to standard rendering. + */ +- (void)initializeWithAdsRenderingSettings:(nullable IMAAdsRenderingSettings *)adsRenderingSettings; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +/** + * Starts advertisement playback. + */ +- (void)start; + +/** + * Pauses advertisement. + */ +- (void)pause; + +/** + * Resumes the advertisement. + */ +- (void)resume; + +/** + * Skips the advertisement if the ad is skippable and the skip offset has been reached. + * IMAAdsManager.skip() only skips ads if IMA does not render the 'Skip ad' button. + */ +- (void)skip; + +/** + * Performs a clickthrough on the advertisement if the UI was successfully disabled using + * AdsRenderingSettings.disableUi. + * :nodoc: + */ +- (void)clicked; + +/** + * Causes the ads manager to stop the ad and clean its internal state. + */ +- (void)destroy; + +/** + * If an ad break is currently playing, discard it and resume content. + * Otherwise, ignore the next scheduled ad break. + */ +- (void)discardAdBreak; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdsRenderingSettings.h b/ios/IMAAdsRenderingSettings.h new file mode 100755 index 0000000..535f61d --- /dev/null +++ b/ios/IMAAdsRenderingSettings.h @@ -0,0 +1,141 @@ +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * The default value of |bitrate property|, causes the effective bitrate to + * be automatically selected. + */ +extern const NSInteger kIMAAutodetectBitrate; + +#pragma mark IMALinkOpenerDelegate + +/** + * Signals that a link has been opened/closed. + * For an external app (Mobile Safari/App deep link), the delegate is only notified + * before opening. + */ +@protocol IMALinkOpenerDelegate + +@optional + +/** + * Called when Safari or app deep link is about to be opened. + * + * @param linkOpener the receiving object + */ +- (void)linkOpenerWillOpenExternalApplication:(NSObject *)linkOpener; + +/** + * Called before in-app browser/app store opens. + * + * @param linkOpener the receiving object. + */ +- (void)linkOpenerWillOpenInAppLink:(NSObject *)linkOpener; + +/** + * Called when the in app browser/app-store is shown on the screen. + * + * @param linkOpener the receiving object + */ +- (void)linkOpenerDidOpenInAppLink:(NSObject *)linkOpener; + +/** + * Called when in-app browser/app-store is about to close. + * + * @param linkOpener the receiving object + */ +- (void)linkOpenerWillCloseInAppLink:(NSObject *)linkOpener; + +/** + * Called when in-app browser/app-store finishes closing. + * + * @param linkOpener the receiving object + */ +- (void)linkOpenerDidCloseInAppLink:(NSObject *)linkOpener; + +@end + +#pragma mark - IMAAdsRenderingSettings + +/** + * Set of properties that influence how ads are rendered. + */ +@interface IMAAdsRenderingSettings : NSObject + +/** + * If specified, the SDK will play the media with MIME type on the list. + * List of strings specifying the MIME types. When empty, the SDK will + * use its default list of MIME types supported on iOS. + * Example: @[ @"video/mp4", @"application/x-mpegURL" ] + * The property is an empty array by default. + */ +@property(nonatomic, copy, nullable) NSArray *mimeTypes; + +/** + * Maximum recommended bitrate. The value is in kbit/s. + * SDK will pick media with bitrate below the specified max, or the closest + * bitrate if there is no media with smaller bitrate found. + * Default value, |kIMAAutodetectBitrate|, means the bitrate will be selected + * by the SDK, using the currently detected network speed (cellular or Wi-Fi). + */ +@property(nonatomic) NSInteger bitrate; + +/** + * Timeout (in seconds) when loading a video ad media file. If loading takes + * longer than this timeout, the ad playback is canceled and the next ad in the + * pod plays, if available. Use -1 for the default of 8 seconds. + */ +@property(nonatomic) NSTimeInterval loadVideoTimeout; + +/** + * For VMAP and ad rules playlists, only play ad breaks scheduled after this time (in seconds). + * This setting is strictly after the specified time. For example, setting playAdsAfterTime to + * 15 will ignore an ad break scheduled to play at 15s. + */ +@property(nonatomic) NSTimeInterval playAdsAfterTime; + +/** + * Specifies the list of UI elements that should be visible. + * This property may be ignored for AdSense/AdX ads. For valid values, see + * IMAUiElementType. This field + * is ignored on tvOS, where UI elements are unavailable. + */ +@property(nonatomic, copy, nullable) NSArray *uiElements; + +/** + * Whether or not to disable ad UI for non TrueView ads. Check Ad.getDisableUi to check if this + * request was honored. Default is false. + * :nodoc: + */ +@property(nonatomic) BOOL disableUi; + +/** + * Whether or not the SDK will preload ad media. Default is YES. + */ +@property(nonatomic) BOOL enablePreloading; + +/** + * Specifies the optional UIViewController that will be used to open links in-app. + * When nil, tapping the video ad "Learn More" button or companion ads + * will result in opening Safari browser. Setting this allows the SDK to open links in-app. This + * field is ignored on tvOS, where Safari is not available. + */ +@property(nonatomic, weak, nullable) UIViewController *linkOpenerPresentingController; + +/** + * The IMALinkOpenerDelegate to be notified when a link is opened/closed. + * Web links are unavailable on tvOS, but this delegate will be used to notify for deep links. + */ +@property(nonatomic, weak, nullable) id linkOpenerDelegate; + +/** + * Toggle this to allow web links to open externally. + * Default is false, ignored if @c linkOpenerPresentingController is nil. + * :nodoc: + */ +@property(nonatomic) BOOL openWebLinksExternally; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdsRequest.h b/ios/IMAAdsRequest.h new file mode 100755 index 0000000..7a9e4cc --- /dev/null +++ b/ios/IMAAdsRequest.h @@ -0,0 +1,200 @@ +// +// IMAAdsRequest.h +// GoogleIMA3 +// +// Copyright (c) 2013 Google Inc. All rights reserved. +// +// Declares a simple ad request class. + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class IMAAdDisplayContainer; +@class IMAAVPlayerContentPlayhead; +@class IMAAVPlayerVideoDisplay; +@class IMAPictureInPictureProxy; +@class IMASecureSignals; +@protocol IMAContentPlayhead; + +/** + * Data class describing the ad request. + */ +@interface IMAAdsRequest : NSObject + +/** + * Specifies the full URL to use for ads loading from an ad server. Required + * for any adsRequest. For details on constructing the ad tag url, + * see + * Create a main ad video tag manually. + */ +@property(nonatomic, copy, readonly, nullable) NSString *adTagUrl; + +/** + * Specifies a VAST, VMAP, or ad rules response to be used instead of making a + * request through an ad tag URL. This can be useful for debugging and other situations + * in which an ad response is already available. + */ +@property(nonatomic, copy, readonly, nullable) NSString *adsResponse; + +/** + * The ad display container. + */ +@property(nonatomic, readonly) IMAAdDisplayContainer *adDisplayContainer; + +/** + * The user context. + */ +@property(nonatomic, readonly, nullable) id userContext; + +/** + * Specifies whether the player intends to start the content and ad in + * response to a user action or whether they will be automatically played. + * Changing this setting will have no impact on ad playback. + */ +@property(nonatomic) BOOL adWillAutoPlay; + +/** + * Specifies whether the player intends to start the content and ad with no volume. + * Changing this setting will have no impact on ad playback. + */ +@property(nonatomic) BOOL adWillPlayMuted; + +/** + * Specifies whether the player intends to continuously play the content videos one after + * another similar to TV broadcast. Not calling this function leaves the setting as unknown. + * Note: Changing this setting will have no impact on ad playback. + */ +@property(nonatomic) BOOL continuousPlayback; + +/** + * Specifies the duration of the content in seconds to be shown. Used in AdX requests. This + * parameter is optional. + */ +@property(nonatomic) float contentDuration; + +/** + * Specifies the keywords used to describe the content to be shown. Used in AdX requests. This + * parameter is optional. + */ +@property(nonatomic, copy, nullable) NSArray *contentKeywords; + +/** + * Specifies the title of the content to be shown. Used in AdX requests. This parameter is + * optional. + */ +@property(nonatomic, copy, nullable) NSString *contentTitle; + +/** + * Specifies the Secure Signal with custom data for this ads request. Secure Signal with custom + * data is an encrypted blob containing signals collected by the publisher and previously agreed + * upon by the publisher and bidder. The Secure Signal with custom data can be cleared out by + * passing null to this function. + */ +@property(nonatomic, strong, nullable) IMASecureSignals *secureSignals; + +/** + * Specifies the universal link to the content's screen. If provided, this parameter is passed to + * the OM SDK. See Apple + * documentation for more information. + */ +@property(nonatomic, copy, nullable) NSURL *contentURL; + +/** + * Specifies the VAST load timeout in milliseconds for the initial request and any subsequent + * wrappers. This parameter is optional and will override the default timeout. + */ +@property(nonatomic) float vastLoadTimeout; + +/** + * Specifies the maximum amount of time to wait in seconds, after calling requestAds, + * before requesting the ad tag URL. This can be used to stagger requests during a + * live-stream event, in order to mitigate spikes in the number of requests. + */ +@property(nonatomic) float liveStreamPrefetchSeconds; + +/** + * Initializes an ads request instance with the given canned ads response and ad display + * container with Picture-in-Picture support. Serial ad requests may reuse the + * same IMAAdDisplayContainer by first calling [IMAAdsManager destroy] on its + * current adsManager. Concurrent requests must use different ad containers. + * + * @param adsResponse the canned ads response + * @param adDisplayContainer the IMAAdDisplayContainer for rendering the ad UI + * @param avPlayerVideoDisplay the IMAAVPlayerVideoDisplay for rendering ads + * @param pictureInPictureProxy the IMAPictureInPictureProxy for tracking PIP events + * @param userContext the user context for tracking requests (optional) + * + * @return the IMAAdsRequest instance + */ +- (instancetype)initWithAdsResponse:(NSString *)adsResponse + adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer + avPlayerVideoDisplay:(IMAAVPlayerVideoDisplay *)avPlayerVideoDisplay + pictureInPictureProxy:(IMAPictureInPictureProxy *)pictureInPictureProxy + userContext:(nullable id)userContext API_AVAILABLE(ios(9.0), tvos(14.0)); + +/** + * Initializes an ads request instance with the given canned ads response and ad display + * container. Serial ad requests may reuse the same IMAAdDisplayContainer by + * first calling [IMAAdsManager destroy] on its current adsManager. Concurrent + * requests must use different ad containers. Does not support Picture-in-Picture. + * + * @param adsResponse the canned ads response + * @param adDisplayContainer the IMAAdDisplayContainer for rendering the ad UI + * @param contentPlayhead the IMAContentPlayhead for the content player (optional) + * @param userContext the user context for tracking requests (optional) + * + * @return the IMAAdsRequest instance + */ +- (instancetype)initWithAdsResponse:(NSString *)adsResponse + adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer + contentPlayhead:(nullable NSObject *)contentPlayhead + userContext:(nullable id)userContext NS_DESIGNATED_INITIALIZER; + +/** + * Initializes an ads request instance with the given ad tag URL and ad display + * container with Picture-in-Picture support. Serial ad requests may reuse the + * same IMAAdDisplayContainer by first calling [IMAAdsManager destroy] on its + * current adsManager. Concurrent requests must use different ad containers. + * + * @param adTagUrl the ad tag URL + * @param adDisplayContainer the IMAAdDisplayContainer for rendering the ad UI + * @param avPlayerVideoDisplay the IMAAVPlayerVideoDisplay for rendering ads + * @param pictureInPictureProxy the IMAPictureInPictureProxy for tracking PIP events + * @param userContext the user context for tracking requests (optional) + * + * @return the IMAAdsRequest instance + */ +- (instancetype)initWithAdTagUrl:(NSString *)adTagUrl + adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer + avPlayerVideoDisplay:(IMAAVPlayerVideoDisplay *)avPlayerVideoDisplay + pictureInPictureProxy:(IMAPictureInPictureProxy *)pictureInPictureProxy + userContext:(nullable id)userContext API_AVAILABLE(ios(9.0), tvos(14.0)); + +/** + * Initializes an ads request instance with the given ad tag URL and ad display + * container. Serial ad requests may reuse the same IMAAdDisplayContainer by + * first calling [IMAAdsManager destroy] on its current adsManager. Concurrent + * requests must use different ad containers. Does not support Picture-in-Picture. + * + * @param adTagUrl the ad tag URL + * @param adDisplayContainer the IMAAdDisplayContainer for rendering the ad UI + * @param contentPlayhead the IMAContentPlayhead for the content player (optional) + * @param userContext the user context for tracking requests (optional) + * + * @return the IMAAdsRequest instance + */ +- (instancetype)initWithAdTagUrl:(NSString *)adTagUrl + adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer + contentPlayhead:(nullable NSObject *)contentPlayhead + userContext:(nullable id)userContext NS_DESIGNATED_INITIALIZER; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMACompanionAd.h b/ios/IMACompanionAd.h new file mode 100755 index 0000000..799fe51 --- /dev/null +++ b/ios/IMACompanionAd.h @@ -0,0 +1,28 @@ +#import + +NS_ASSUME_NONNULL_BEGIN + +/** An object that holds data corresponding to the companion ad. */ +@interface IMACompanionAd : NSObject + +/** The value for the resource of this companion. */ +@property(nonatomic, copy, readonly, nullable) NSString *resourceValue; + +/** The API needed to execute this ad, or nil if unavailable. */ +@property(nonatomic, copy, readonly, nullable) NSString *APIFramework; + +/** The width of the companion in pixels. 0 if unavailable. */ +@property(nonatomic, readonly) NSInteger width; + +/** The height of the companion in pixels. 0 if unavailable. */ +@property(nonatomic, readonly) NSInteger height; + +/** + * Obtain an instance from IMAAd.companionAds. + * :nodoc: + */ +- (nonnull instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMACompanionAdSlot.h b/ios/IMACompanionAdSlot.h new file mode 100755 index 0000000..baaddbb --- /dev/null +++ b/ios/IMACompanionAdSlot.h @@ -0,0 +1,111 @@ +// +// IMACompanionAdSlot.h +// GoogleIMA3 +// +// Copyright (c) 2013 Google Inc. All rights reserved. +// +// Declares a data class that describes a companion ad slot. + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * Fluid companion ads have no fixed size, but rather adapt to fit the creative + * content they display. Set width and height to fluid size to allow companion + * slot to be filled by fluid companion ad. + */ +extern const NSInteger kIMAFluidSize; + +@class IMACompanionAdSlot; + +#pragma mark IMACompanionDelegate + +/** + * Delegate to receive events from the companion ad slot. + */ +@protocol IMACompanionDelegate + +@optional + +/** + * Called when the slot is either filled or not filled. + * + * @param slot the IMACompanionAdSlot receiving the event + * @param filled is the slot filled or not + */ +- (void)companionSlot:(IMACompanionAdSlot *)slot filled:(BOOL)filled; + +/** + * Called when the slot is clicked on by the user and will + * successfully navigate away. + * + * @param slot the IMACompanionAdSlot receiving the event + */ +- (void)companionSlotWasClicked:(IMACompanionAdSlot *)slot; + +@end + +#pragma mark - IMACompanionAdSlot + +/** + * Ad slot for companion ads. The SDK will put a subview inside the provided + * UIView container. The companion will be matched to the width and height + * provided here. This class cannot be instantiated on tvOS, where companion ads + * are not available. + */ +@interface IMACompanionAdSlot : NSObject + +/** + * The view the companion will be rendered in. Display this view in your + * application before video ad starts. + */ +@property(nonatomic, readonly) UIView *view; + +/** + * Width of the slot, in pixels. This value is sent to the DFP ad server for + * targeting. + */ +@property(nonatomic, readonly) NSInteger width; + +/** + * Height of the slot, in pixels. This value is sent to the DFP ad server for + * targeting. + */ +@property(nonatomic, readonly) NSInteger height; + +/** + * The IMACompanionDelegate for receiving events from the companion ad slot. + */ +@property(nonatomic, weak, nullable) id delegate; + +/** + * Initializes an instance of a IMACompanionAdSlot with design ad width and height. + * + * @param view the UIView that will contain the companion ad + * @param width the chosen width of the ad + * @param height the chosen height of the ad + * + * @return the IMACompanionAdSlot instance + */ +- (instancetype)initWithView:(UIView *)view + width:(NSInteger)width + height:(NSInteger)height __TVOS_UNAVAILABLE; + +/** + * Initializes an instance of a IMACompanionAdSlot with fluid size. + * + * @param view the UIView that will contain the companion ad. + * + * @return the IMACompanionAdSlot instance + */ +- (instancetype)initWithView:(UIView *)view __TVOS_UNAVAILABLE; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAContentPlayhead.h b/ios/IMAContentPlayhead.h new file mode 100755 index 0000000..4360949 --- /dev/null +++ b/ios/IMAContentPlayhead.h @@ -0,0 +1,37 @@ +// +// IMAContentPlayhead.h +// GoogleIMA3 +// +// Copyright (c) 2013 Google Inc. All rights reserved. +// +// Defines protocol for wrapping content playhead used in content tracking. + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * Property name used for key value observation. + */ +extern NSString *const kIMAPropertyCurrentTime; + +/** + * Defines an interface for a class that tracks video content progress and + * exposes a key value observable property |currentTime|. + * The SDK provides an implementation for tracking AVPlayer-based playback + * in the IMAAVPlayerContentPlayhead. + * Publishers can supply their own implementation by implementing this + * interface and this way support any other video playback implementation + * they might have. + */ +@protocol IMAContentPlayhead + +/** + * Reflects the current playback time in seconds for the content. + * The property is key value observable. + */ +@property(nonatomic, readonly) NSTimeInterval currentTime; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMACuepoint.h b/ios/IMACuepoint.h new file mode 100755 index 0000000..65e8480 --- /dev/null +++ b/ios/IMACuepoint.h @@ -0,0 +1,38 @@ +// +// IMACuepoint.h +// GoogleIMA3_ios +// +// Represents a cuepoint with a start and end time. + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * Data object representation of a cuepoint for a single ad break. + */ +@interface IMACuepoint : NSObject + +/** + * The start time of the cuepoint in seconds. + */ +@property(nonatomic, readonly) NSTimeInterval startTime; + +/** + * The end time of the cuepoint in seconds. + */ +@property(nonatomic, readonly) NSTimeInterval endTime; + +/** + * Specifies whether this cuepoint has been played. + */ +@property(nonatomic, readonly, getter=isPlayed) BOOL played; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAFriendlyObstruction.h b/ios/IMAFriendlyObstruction.h new file mode 100755 index 0000000..868b803 --- /dev/null +++ b/ios/IMAFriendlyObstruction.h @@ -0,0 +1,45 @@ +#import + +NS_ASSUME_NONNULL_BEGIN + +/** A list of purposes for which an obstruction would be registered as friendly. */ +typedef NS_ENUM(NSUInteger, IMAFriendlyObstructionPurpose) { + IMAFriendlyObstructionPurposeMediaControls, + IMAFriendlyObstructionPurposeCloseAd, + IMAFriendlyObstructionPurposeNotVisible, + IMAFriendlyObstructionPurposeOther, +}; + +/** An obstruction that is marked as "friendly" for viewability measurement purposes. */ +@interface IMAFriendlyObstruction : NSObject + +/** The view causing the obstruction. */ +@property(nonatomic, readonly) UIView *view; + +/** The purpose for registering the obstruction as friendly. */ +@property(nonatomic, readonly) IMAFriendlyObstructionPurpose purpose; + +/** + * Optional, detailed reasoning for registering this obstruction as friendly. + * If the detailedReason is not null, it must follow the IAB + * standard by being 50 characters or less and only containing characters + * A-z, 0-9, or spaces. + */ +@property(nonatomic, readonly, nullable) NSString *detailedReason; + +/** + * Initializes a friendly obstruction. + * + * @param view The view causing the obstruction. + * @param purpose The purpose for registering the obstruction as friendly. + * @param detailedReason Optional, detailed reasoning for registering this obstruction as friendly. + * + * @return A new IMAFriendlyObstruction instance + */ +- (instancetype)initWithView:(UIView *)view + purpose:(IMAFriendlyObstructionPurpose)purpose + detailedReason:(nullable NSString *)detailedReason; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMALiveStreamRequest.h b/ios/IMALiveStreamRequest.h new file mode 100755 index 0000000..1b38723 --- /dev/null +++ b/ios/IMALiveStreamRequest.h @@ -0,0 +1,73 @@ +// +// IMALiveStreamRequest.h +// GoogleIMA3_ios +// +// Declares a representation of a stream request for live streams. +// +// + +#import "IMAPictureInPictureProxy.h" +#import "IMAStreamRequest.h" + +NS_ASSUME_NONNULL_BEGIN + +@class IMAAdDisplayContainer; +@protocol IMAVideoDisplay; + +/** + * Data object describing a live stream request. + */ + +@interface IMALiveStreamRequest : IMAStreamRequest + +/** + * This is used to determine which stream should be played. + * The live stream request asset key is an identifier which can be + * found in the DFP UI. + * + * @type {!string} + */ +@property(nonatomic, copy, readonly) NSString *assetKey; + +/** + * Initializes a live stream request instance with the given assetKey. Uses the given ad display + * container to display the stream. + * + * @param assetKey the stream assetKey + * @param adDisplayContainer the IMAAdDisplayContainer for rendering the ad UI + * @param videoDisplay the IMAVideoDisplay for playing the stream + * @param userContext The user context for tracking requests (optional) + * + * @return the IMALiveStreamRequest instance + */ +- (instancetype)initWithAssetKey:(NSString *)assetKey + adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer + videoDisplay:(id)videoDisplay + userContext:(nullable id)userContext; + +/** + * Initializes a live stream request instance with the given assetKey. Uses the given ad display + * container to display the stream. Uses the picture in picture proxy to track PIP events. + * + * @param assetKey the stream assetKey + * @param adDisplayContainer the IMAAdDisplayContainer for rendering the ad UI + * @param videoDisplay the IMAVideoDisplay for playing the stream + * @param pictureInPictureProxy the IMAPictureInPictureProxy for tracking PIP events + * @param userContext The user context for tracking requests (optional) + * + * @return the IMALiveStreamRequest instance + */ +- (instancetype)initWithAssetKey:(NSString *)assetKey + adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer + videoDisplay:(id)videoDisplay + pictureInPictureProxy:(nullable IMAPictureInPictureProxy *)pictureInPictureProxy + userContext:(nullable id)userContext; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAPictureInPictureProxy.h b/ios/IMAPictureInPictureProxy.h new file mode 100755 index 0000000..d4453e9 --- /dev/null +++ b/ios/IMAPictureInPictureProxy.h @@ -0,0 +1,70 @@ +// +// IMAPictureInPictureProxy.h +// GoogleIMA3 +// +// Copyright (c) 2015 Google Inc. All rights reserved. +// +// Defines a proxy for wrapping an AVPlayerViewControllerDelegate or +// AVPictureInPictureControllerDelegate for handling Picture-in-Picture. + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol AVPlayerViewControllerDelegate; +@protocol AVPictureInPictureControllerDelegate; + +/** + * A proxy class for allowing the SDK to detect entering and exiting + * Picture-in-Picture. + * + * To use the proxy, create an instance of IMAPictureInPictureProxy with the + * Picture-in-Picture delegate as an argument, and then simply set the + * Picture-in-Picture controller's delegate to the proxy. See + * + * Picture in Picture for more details. + */ +#if TARGET_OS_IOS || (TARGET_OS_TV && __TV_OS_VERSION_MAX_ALLOWED >= 140000) +@interface IMAPictureInPictureProxy + : NSProxy +#else +@interface IMAPictureInPictureProxy : NSObject +#endif +/** + * Whether or not Picture-in-Picture is currently active. + */ +@property(nonatomic, readonly, getter=isPictureInPictureActive) BOOL pictureInPictureActive; + +/** + * Whether or not Picture-in-Picture is supported on this device. + */ ++ (BOOL)isPictureInPictureSupported; + +/** + * Instantiates an IMAPictureInPictureProxy that will proxy delegate + * messages from an AVPictureInPictureController, and forward them + * to the AVPictureInPictureControllerDelegate passed on init. + * + * @param delegate the AVPictureInPictureControllerDelegate + * + * @return an IMAPictureInPictureProxy instance + */ +- (instancetype)initWithAVPictureInPictureControllerDelegate: + (id)delegate API_AVAILABLE(ios(9.0), tvos(14.0)); + +/** + * Instantiates an IMAPictureInPictureProxy that will proxy delegate + * messages from an AVPlayerViewController, and forward them to the + * AVPlayerViewControllerDelegate passed on init. + * + * @param delegate the AVPlayerViewControllerDelegate + * + * @return an IMAPictureInPictureProxy instance + */ +- (instancetype)initWithAVPlayerViewControllerDelegate:(id)delegate + API_AVAILABLE(ios(9.0), tvos(14.0)); + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAPodStreamRequest.h b/ios/IMAPodStreamRequest.h new file mode 100755 index 0000000..76d68ad --- /dev/null +++ b/ios/IMAPodStreamRequest.h @@ -0,0 +1,64 @@ +#import "IMAPictureInPictureProxy.h" +#import "IMAStreamRequest.h" + +NS_ASSUME_NONNULL_BEGIN + +@class IMAAdDisplayContainer; +@protocol IMAVideoDisplay; + +/** Data object describing a stream request for a pod serving stream. */ +@interface IMAPodStreamRequest : IMAStreamRequest + +/** The network code for the stream request. */ +@property(nonatomic, copy, readonly) NSString *networkCode; + +/** The custom asset key for the stream request. */ +@property(nonatomic, copy, readonly) NSString *customAssetKey; + +/** + * Initializes a stream request instance with the given network code and custom + * asset key. Uses the given ad display container to display the stream. + * + * @param networkCode The network code for the stream. + * @param customAssetKey The asset key for the stream. + * @param adDisplayContainer The IMAAdDisplayContainer for rendering the ad UI. + * @param videoDisplay The IMAVideoDisplay where the stream will be played. + * @param userContext The user context for tracking requests (optional) + * + * @return The IMAPodStreamRequest instance. + */ +- (instancetype)initWithNetworkCode:(NSString *)networkCode + customAssetKey:(NSString *)customAssetKey + adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer + videoDisplay:(id)videoDisplay + userContext:(nullable id)userContext; + +/** + * Initializes a stream request instance with the given network code and custom + * asset key. Uses the given ad display container to display the stream. Uses the picture in picture + * proxy to track PIP events. + * + * @param networkCode The network code for the stream. + * @param customAssetKey The asset key for the stream. + * @param adDisplayContainer The IMAAdDisplayContainer for rendering the ad UI. + * @param videoDisplay The IMAVideoDisplay where the stream will be played. + * @param pictureInPictureProxy The IMAPictureInPictureProxy for tracking PIP events. + * @param userContext The user context for tracking requests (optional) + * + * @return The IMAPodStreamRequest instance. + */ +- (instancetype)initWithNetworkCode:(NSString *)networkCode + customAssetKey:(NSString *)customAssetKey + adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer + videoDisplay:(id)videoDisplay + pictureInPictureProxy:(nullable IMAPictureInPictureProxy *)pictureInPictureProxy + userContext:(nullable id)userContext; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAPodVODStreamRequest.h b/ios/IMAPodVODStreamRequest.h new file mode 100755 index 0000000..368a227 --- /dev/null +++ b/ios/IMAPodVODStreamRequest.h @@ -0,0 +1,59 @@ +#import "IMAPictureInPictureProxy.h" +#import "IMAStreamRequest.h" + +NS_ASSUME_NONNULL_BEGIN + +@class IMAAdDisplayContainer; +@protocol IMAVideoDisplay; + +/** + * Data object describing a stream request for a third party stitched server-side ad insertion pod + * serving VOD stream. + */ +@interface IMAPodVODStreamRequest : IMAStreamRequest + +/** The network code for the stream request. */ +@property(nonatomic, copy, readonly) NSString *networkCode; + +/** + * Initializes a stream request instance with the given network. Uses the given ad display container + * to display the stream. + * + * @param networkCode The network code for the stream. + * @param adDisplayContainer The IMAAdDisplayContainer for rendering the ad UI. + * @param videoDisplay The IMAVideoDisplay where the stream will be played. + * @param userContext The user context for tracking requests (optional) + * + * @return The IMAPodVODStreamRequest instance. + */ +- (instancetype)initWithNetworkCode:(NSString *)networkCode + adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer + videoDisplay:(id)videoDisplay + userContext:(nullable id)userContext; + +/** + * Initializes a stream request instance with the given network code. Uses the given ad display + * container to display the stream. Uses the picture in picture proxy to track PIP events. + * + * @param networkCode The network code for the stream. + * @param adDisplayContainer The IMAAdDisplayContainer for rendering the ad UI. + * @param videoDisplay The IMAVideoDisplay where the stream will be played. + * @param pictureInPictureProxy The IMAPictureInPictureProxy for tracking PIP events. + * @param userContext The user context for tracking requests (optional) + * + * @return The IMAPodVODStreamRequest instance. + */ +- (instancetype)initWithNetworkCode:(NSString *)networkCode + adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer + videoDisplay:(id)videoDisplay + pictureInPictureProxy:(nullable IMAPictureInPictureProxy *)pictureInPictureProxy + userContext:(nullable id)userContext; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMASecureSignals.h b/ios/IMASecureSignals.h new file mode 100755 index 0000000..52530b3 --- /dev/null +++ b/ios/IMASecureSignals.h @@ -0,0 +1,25 @@ +#import + +NS_ASSUME_NONNULL_BEGIN + +// Stores the signal data for SecureSignals. Currently used to store signal for PCS only. +@interface IMASecureSignals : NSObject + +/** + * Secure Signal with custom data sent with ads request. Secure Signal with custom + * data is an encrypted blob containing signals collected by the publisher and previously agreed + * upon by the publisher and bidder。 + */ + +@property(nonatomic, copy, readonly) NSString *customData; + +- (instancetype)initWithCustomData:(NSString *)customData NS_DESIGNATED_INITIALIZER; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMASecureSignalsAdapter.h b/ios/IMASecureSignalsAdapter.h new file mode 100755 index 0000000..08de9f9 --- /dev/null +++ b/ios/IMASecureSignalsAdapter.h @@ -0,0 +1,34 @@ +#import + +@class IMAVersion; + +NS_ASSUME_NONNULL_BEGIN + +/** Completion handler for signal generation. Returns either signals or an error object. */ +typedef void (^IMASignalCompletionHandler)(NSString *_Nullable signals, NSError *_Nullable error); + +/** Adapter that provides secure signal(3rd party signal only) to the IMA SDK to be included in an + * auction. */ +@protocol IMASecureSignalsAdapter + +/** Initializes the Secure Signal adapter. */ +- (nullable instancetype)init; + +/** The version of the adapter. */ ++ (IMAVersion *)adapterVersion; + +/** The version of the ad SDK. */ ++ (IMAVersion *)adSDKVersion; + +/** + * Asks the receiver for encrypted signals. Signals are provided to the 3PAS at request time. The + * receiver must call @c completionHandler with signals or an error. + * This method is called on a non-main thread. The receiver should avoid using the main thread to + * prevent signal collection timeouts. + * @param completion The block to call when signal collection is complete. + */ +- (void)collectSignalsWithCompletion:(IMASignalCompletionHandler)completion; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMASettings.h b/ios/IMASettings.h new file mode 100755 index 0000000..01cc589 --- /dev/null +++ b/ios/IMASettings.h @@ -0,0 +1,94 @@ +// +// IMASettings.h +// GoogleIMA3 +// +// Copyright (c) 2015 Google Inc. All rights reserved. +// +// Stores SDK wide settings. Only instantiated in the SDK. + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * The IMASettings class stores SDK wide settings. + */ +@interface IMASettings : NSObject + +/** + * Publisher Provided Identification (PPID) sent with ads request. + */ +@property(nonatomic, copy, nullable) NSString *ppid; + +/** + * Language specification used for localization. |Language| must be formatted as + * a canonicalized IETF BCP 47 language identifier such as would be returned by + * [NSLocale preferredLanguages]. Setting this property after it has been sent + * to the IMAAdsLoader will be ignored and a warning will be logged. + */ +@property(nonatomic, copy) NSString *language; + +/** + * Specifies maximum number of redirects after which subsequent redirects will + * be denied, and the ad load aborted. The number of redirects directly affects + * latency and thus user experience. This applies to all VAST wrapper ads. If + * the number of redirects exceeds |maxRedirects|, the ad request will fail with + * error code 302. The default value is 4. + */ +@property(nonatomic) NSUInteger maxRedirects; + +/** + * Feature flags and their states. Used to control experimental features. + */ +@property(nonatomic, copy) NSDictionary *featureFlags; + +/** + * Enable background audio playback for the SDK. The default value is NO. + */ +@property(nonatomic) BOOL enableBackgroundPlayback; + +/** + * Specifies whether to automatically play VMAP and ad rules ad breaks. The + * default value is YES. + */ +@property(nonatomic) BOOL autoPlayAdBreaks; + +/** + * Specifies whether to update the MPNowPlayingInfoCenter content with the + * title "Advertisement". If disabled, MPNowPlayingInfoCenter is untouched. + * The default value is NO. + */ +@property(nonatomic) BOOL disableNowPlayingInfo; + +/** + * The partner specified video player that is integrating with the SDK. + */ +@property(nonatomic, copy, nullable) NSString *playerType; + +/** + * The partner specified player version that is integrating with the SDK. + */ +@property(nonatomic, copy, nullable) NSString *playerVersion; + +/** + * The session ID to identify a single user session. This should be a UUID. It + * is used exclusively for frequency capping across the user session. + */ +@property(nonatomic, copy, nullable) NSString *sessionID; + +/** + * Controls whether Same App Key is enabled. The value set persists across app sessions. The key is + * enabled by default. + */ +@property(nonatomic) BOOL sameAppKeyEnabled __TVOS_UNAVAILABLE; + +/** + * Toggles debug mode which will output detailed log information to the console. + * Debug mode should be disabled in Release and will display a watermark when + * enabled. The default value is NO. + */ +@property(nonatomic) BOOL enableDebugMode; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAStreamManager.h b/ios/IMAStreamManager.h new file mode 100755 index 0000000..616b251 --- /dev/null +++ b/ios/IMAStreamManager.h @@ -0,0 +1,184 @@ +// +// IMAStreamManager.h +// GoogleIMA3 +// +// Copyright (c) 2015 Google Inc. All rights reserved. +// +// Declares IMAStreamManager interface that manages stream playback. +// The interface represents an abstract API. There can be only one stream managed by a single +// stream manager. +// The implementing code should respond to the callbacks as defined in IMAStreamManagerDelegate. +// +// A typical stream playback session: +// 1. Stream manager is retrieved. Delegate is set. +// 2. Stream playback will meanwhile start because of the adsLoader requestStream call. +// 3. delegate.didReceiveAdEvent: is called with a kIMAAdBreakStarted event. +// 4. Publisher should now hide content controls or disable seeking. Ad is now playing +// 5. delegate.didReceiveAdEvent: is called with a kIMAAdStart event. This event comes with +// information about the ad. +// 6. delegate.didReceiveAdEvent is called with ad events like quartiles, midpoint and complete. +// 7. Ad break finishes and delegate.didReceiveAdEvent is called with a kIMAAdBreakEnded event. +// 8. Publisher should now show content controls or reenable seeking. Content is now playing. +// playback should resume now. +// It is possible to detach the delegate and destroy the ads manager. +// +// Steps 3-8 may repeat several times for the same stream if there are multiple ads inserted in +// the stream. + +#import + +#import "IMAAdError.h" +#import "IMAAdEvent.h" +#import "IMAAdPlaybackInfo.h" +#import "IMAAdsRenderingSettings.h" +#import "IMAContentPlayhead.h" + +NS_ASSUME_NONNULL_BEGIN + +@class IMACuepoint; +@class IMAStreamManager; + +#pragma mark IMAStreamManagerDelegate + +/** + * A callback protocol for IMAStreamManager. + */ +@protocol IMAStreamManagerDelegate + +/** + * Called when there is an IMAAdEvent. + * + * @param streamManager the IMAStreamManager receiving the event + * @param event the IMAAdEvent received + */ +- (void)streamManager:(IMAStreamManager *)streamManager didReceiveAdEvent:(IMAAdEvent *)event; + +/** + * Called when there is an IMAAdEvent. + * + * @param streamManager the IMAStreamManager receiving the error + * @param error the IMAAdError received + */ +- (void)streamManager:(IMAStreamManager *)streamManager didReceiveAdError:(IMAAdError *)error; + +@optional + +/** + * Called when the ad is playing to give updates about ad progress. + * + * @param streamManager the IMAStreamManager tracking ad playback + * @param time the current ad playback time in seconds + * @param adDuration the total duration of the current ad in seconds + * @param adPosition the ad position of the current ad in the current ad break + * @param totalAds the total number of ads in the current ad break + * @param adBreakDuration the total duration of the current ad break in seconds + * @param adPeriodDuration the total duration of the current ad period in seconds. This includes ads + * duration plus slate. + */ +- (void)streamManager:(IMAStreamManager *)streamManager + adDidProgressToTime:(NSTimeInterval)time + adDuration:(NSTimeInterval)adDuration + adPosition:(NSInteger)adPosition + totalAds:(NSInteger)totalAds + adBreakDuration:(NSTimeInterval)adBreakDuration + adPeriodDuration:(NSTimeInterval)adPeriodDuration; + +@end + +#pragma mark - IMAStreamManager + +/** + * The IMAStreamManager class is responsible for playing streams. + */ +@interface IMAStreamManager : NSObject + +/** + * The IMAStreamManagerDelegate to notify with events during stream playback. + */ +@property(nonatomic, weak, nullable) NSObject *delegate; + +/** + * Identifier used during dynamic ad insertion to uniquely identify a stream. This can be used in + * the Stream Activity Monitor Debug Console to debug the stream session. + */ +@property(nonatomic, copy, readonly, nullable) NSString *streamId; + +/** + * The cuepoints for the current stream, populated after @c kIMAAdEvent_CUEPOINTS_CHANGED event is + * dispatched. Will be empty for live streams. + */ +@property(nonatomic, readonly) NSArray *cuepoints; + +/** + * Initializes and loads the stream. + * + * @param adsRenderingSettings the IMAAdsRenderingSettings. Pass in to influence ad rendering. + * Use nil to default to standard rendering. + */ +- (void)initializeWithAdsRenderingSettings:(nullable IMAAdsRenderingSettings *)adsRenderingSettings; + +/** + * Returns the stream time with ads for a given content time. Returns the given content time + * for live streams. + * + * @param contentTime the content time without any ads (in seconds) + * + * @return the stream time that corresponds with the given content time once ads are inserted + */ +- (NSTimeInterval)streamTimeForContentTime:(NSTimeInterval)contentTime; + +/** + * Returns the content time without ads for a given stream time. Returns the given stream time + * for live streams. + * + * @param streamTime the stream time with inserted ads (in seconds) + * + * @return the content time that corresponds with the given stream time once ads are removed + */ +- (NSTimeInterval)contentTimeForStreamTime:(NSTimeInterval)streamTime; + +/** + * Returns the previous cuepoint for the given stream time. Returns nil if no such cuepoint exists. + * This is used to implement features like snap back, and called when the publisher detects that + * the user seeked in order to force the user to watch an ad break they may have skipped over. + * + * @param streamTime the stream time that the was seeked to. + * + * @return the previous IMACuepoint for the given stream time. + */ +- (nullable IMACuepoint *)previousCuepointForStreamTime:(NSTimeInterval)streamTime; + +/** + * Replaces all of the ad tag parameters used for upcoming ad requests for a + * live stream. + * Note that this call is a no-op for VOD streams. + * + * @param adTagParameters the new ad tag parameters for the current stream. + */ +- (void)replaceAdTagParameters:(nullable NSDictionary *)adTagParameters; + +/** + * Requests SDK to retrieve the ad metadata and then load the provided streamManifestUrl and + * streamSubtitles into the player. This should be manually triggered once the stream manifest has + * been retrieved from the third party video stitcher. Note that this is only used for Pod serving + * VOD with a third party video stitcher, and is a no-op for other stream request types. + * + * @param streamURL the manifest url for the stream with dynamic ad insertion. + * @param streamSubtitles the subtitles array for the stream. + */ +- (void)loadThirdPartyStream:(NSURL *)streamURL + streamSubtitles:(NSArray *> *)streamSubtitles; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +/** + * Cleans the stream manager's internal state for proper deallocation. + */ +- (void)destroy; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAStreamRequest.h b/ios/IMAStreamRequest.h new file mode 100755 index 0000000..9d9368d --- /dev/null +++ b/ios/IMAStreamRequest.h @@ -0,0 +1,107 @@ +// +// IMAStreamRequest.h +// GoogleIMA3 +// +// Copyright (c) 2015 Google Inc. All rights reserved. +// +// Declares a simple stream request class. + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class IMAAdDisplayContainer; +@class IMASecureSignals; +@protocol IMAVideoDisplay; + +/** + * Data class describing the stream request. + */ +@interface IMAStreamRequest : NSObject + +/** + * The stream display container for displaying the ad UI. + */ +@property(nonatomic, readonly) IMAAdDisplayContainer *adDisplayContainer; + +/** + * The video display where the stream can be played. + */ +@property(nonatomic, readonly) id videoDisplay; + +/** + * The stream request API key. It's configured through the + * + * DFP Admin UI and provided to the publisher to unlock their content. + * It verifies the applications that are attempting to access the content. + */ +@property(nonatomic, copy, nullable) NSString *apiKey; + +/** + * The stream request authorization token. This is used in place of the API key for stricter + * content authorization. The publisher can control individual content streams authorized based + * on this token. + */ +@property(nonatomic, copy, nullable) NSString *authToken; + +/** + * The ID to be used to debug the stream with the stream activity monitor. This is used to provide + * a convenient way to allow publishers to find a stream log in the stream activity monitor tool. + */ +@property(nonatomic, copy, nullable) NSString *streamActivityMonitorID; + +/** + * You can override a limited set of ad tag parameters on your stream request. + * + * Supply targeting parameters to your stream provides more information. + * + * You can use the dai-ot and dai-ov parameters for stream variant preference. + * See + * Override Stream Variant Parameters for more information. + */ +@property(nonatomic, copy, nullable) NSDictionary *adTagParameters; + +/** + * The suffix that the SDK will append to the query of the stream manifest URL. Do not include the + * '?' separator at the start. The SDK will account for the existence of parameters in the URL + * already, removing existing ones that collide with ones supplied here. This suffix needs to be + * sanitized and encoded as the SDK will not do this. + */ +@property(nonatomic, copy, nullable) NSString *manifestURLSuffix; + +/** + * Specifies the universal link to the content's screen. If provided, this parameter is passed to + * the OM SDK. See Apple + * documentation for more information. + */ +@property(nonatomic, copy, nullable) NSURL *contentURL; + +/** + * Enables the addition of a nonce to the request. This is needed to transmit monetization signals + * to Google servers when ads are requested server side from a non Google server. Defaults to false. + * :nodoc: + */ +@property(nonatomic, assign) BOOL enableNonce; + +/** + * Specifies the Secure Signal with custom data for this stream request. Secure Signal with custom + * data is an encrypted blob containing signals collected by the publisher and previously agreed + * upon by the publisher and bidder. The Secure Signal with custom data can be cleared out by + * passing null to this function. + */ +@property(nonatomic, strong, nullable) IMASecureSignals *secureSignals; + +/** + * The user context. + */ +@property(nonatomic, readonly, nullable) id userContext; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAUiElements.h b/ios/IMAUiElements.h new file mode 100755 index 0000000..49c75f1 --- /dev/null +++ b/ios/IMAUiElements.h @@ -0,0 +1,30 @@ +/*! \file IMAUiElements.h + * GoogleIMA3 + * + * Copyright (c) 2013 Google Inc. All rights reserved. + * + * Defines an enum containing the possible UI elements that can be + * customized by the publisher during ad playback. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +#pragma mark IMAUiElementType + +/** + * Different UI elements that can be customized. + */ +typedef NS_ENUM(NSInteger, IMAUiElementType) { + /** + * Ad attribution UI element. + */ + kIMAUiElements_AD_ATTRIBUTION, + /** + * Ad countdown element. + */ + kIMAUiElements_COUNTDOWN +}; + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAUniversalAdID.h b/ios/IMAUniversalAdID.h new file mode 100755 index 0000000..cdd99c0 --- /dev/null +++ b/ios/IMAUniversalAdID.h @@ -0,0 +1,36 @@ +// +// IMAUniversalAdID.h +// GoogleIMA3 +// +// Copyright (c) 2019 Google Inc. All rights reserved. +// +// Represents the universal ad ID information for a single ad. + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * Simple data object containing universal ad ID information. + */ +@interface IMAUniversalAdID : NSObject + +/** + * The universal ad ID value. This will be "unknown" if it isn't defined by the ad. + */ +@property(nonatomic, copy, readonly) NSString *adIDValue; + +/** + * The universal ad ID registry with which the value is registered. This will be "unknown" + * if it isn't defined by the ad. + */ +@property(nonatomic, copy, readonly) NSString *adIDRegistry; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAVODStreamRequest.h b/ios/IMAVODStreamRequest.h new file mode 100755 index 0000000..241c7a6 --- /dev/null +++ b/ios/IMAVODStreamRequest.h @@ -0,0 +1,80 @@ +// +// IMAVODStreamRequest.h +// GoogleIMA3_ios +// +// Declares a representation of a stream request for on-demand streams. +// + +#import "IMAStreamRequest.h" + +NS_ASSUME_NONNULL_BEGIN + +@class IMAAdDisplayContainer; +@class IMAPictureInPictureProxy; +@protocol IMAVideoDisplay; + +/** + * Data object describing a VOD stream request. + */ + +@interface IMAVODStreamRequest : IMAStreamRequest + +/** + * The stream request content source ID. This is used to determine the + * content source of the stream. + */ +@property(nonatomic, copy, readonly) NSString *contentSourceID; + +/** + * The stream request video ID. This is used to determine which specific video + * stream should be played. + */ +@property(nonatomic, copy, readonly) NSString *videoID; + +/** + * Initializes a stream request instance with the given content source ID and video ID. + * Uses the given ad display container to display the stream. This is used for on-demand streams. + * + * @param contentSourceID the content source ID for this stream + * @param videoID the video identifier for this stream + * @param adDisplayContainer the IMAAdDisplayContainer for rendering the ad UI + * @param videoDisplay the IMAVideoDisplay for playing the stream + * @param userContext The user context for tracking requests (optional) + * + * @return the IMAVODStreamRequest instance + */ +- (instancetype)initWithContentSourceID:(NSString *)contentSourceID + videoID:(NSString *)videoID + adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer + videoDisplay:(id)videoDisplay + userContext:(nullable id)userContext; + +/** + * Initializes a stream request instance with the given content source ID and video ID. + * Uses the given ad display container to display the stream. This is used for on-demand streams. + * Uses the picture in picture proxy to track PIP events. + * + * @param contentSourceID the content source ID for this stream + * @param videoID the video identifier for this stream + * @param adDisplayContainer the IMAAdDisplayContainer for rendering the ad UI + * @param videoDisplay the IMAVideoDisplay for playing the stream + * @param pictureInPictureProxy the IMAPictureInPictureProxy for tracking PIP events + * @param userContext The user context for tracking requests (optional) + * + * @return the IMAVODStreamRequest instance + */ +- (instancetype)initWithContentSourceID:(NSString *)contentSourceID + videoID:(NSString *)videoID + adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer + videoDisplay:(id)videoDisplay + pictureInPictureProxy:(nullable IMAPictureInPictureProxy *)pictureInPictureProxy + userContext:(nullable id)userContext; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAVersion.h b/ios/IMAVersion.h new file mode 100755 index 0000000..ce2c952 --- /dev/null +++ b/ios/IMAVersion.h @@ -0,0 +1,14 @@ +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface IMAVersion : NSObject +/** Major version. */ +@property(nonatomic) NSInteger majorVersion; +/** Minor version. */ +@property(nonatomic) NSInteger minorVersion; +/** Patch version. */ +@property(nonatomic) NSInteger patchVersion; +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAVideoDisplay.h b/ios/IMAVideoDisplay.h new file mode 100755 index 0000000..735b621 --- /dev/null +++ b/ios/IMAVideoDisplay.h @@ -0,0 +1,203 @@ +// +// IMAVideoDisplay.h +// GoogleIMA3 +// +// Copyright (c) 2015 Google Inc. All rights reserved. +// +// Declares a simple video display class used for ad playback. + +#import "IMAAdPlaybackInfo.h" + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol IMAVideoDisplay; + +/** + * Delegate object that receives state change callbacks from IMAVideoDisplay. + */ +@protocol IMAVideoDisplayDelegate + +/** + * Informs the SDK that the ad has loaded. + * + * @param videoDisplay the IMAVideoDisplay that loaded the ad + */ +- (void)videoDisplayDidLoad:(id)videoDisplay; + +/** + * Informs the SDK the ad has started playback. This must be called at most once per loadStream: + * or loadUrl: call. + * + * @param videoDisplay the IMAVideoDisplay that started ad playback + */ +- (void)videoDisplayDidStart:(id)videoDisplay; + +/** + * Informs the SDK the ad has paused. + * + * @param videoDisplay the IMAVideoDisplay that paused ad playback + */ +- (void)videoDisplayDidPause:(id)videoDisplay; + +/** + * Informs the SDK the ad has resumed playback. + * + * @param videoDisplay the IMAVideoDisplay that resumed ad playback + */ +- (void)videoDisplayDidResume:(id)videoDisplay; + +/** + * Informs the SDK the ad has completed playback. + * + * @param videoDisplay the IMAVideoDisplay that completed ad playback + */ +- (void)videoDisplayDidComplete:(id)videoDisplay; + +/** + * Informs the SDK the ad was clicked. + * + * @param videoDisplay the IMAVideoDisplay that received the ad click + */ +- (void)videoDisplayDidClick:(id)videoDisplay; + +/** + * Informs the SDK the ad playback failed due to an error. + * + * @param videoDisplay the IMAVideoDisplay that failed to play the ad + * @param error the error that caused the video display to fail to play the ad + */ +- (void)videoDisplay:(id)videoDisplay didReceiveError:(NSError *)error; + +/** + * Informs the SDK the ad was skipped. + * + * @param videoDisplay the IMAVideoDisplay that skipped the ad + */ +- (void)videoDisplayDidSkip:(id)videoDisplay; + +/** + * Informs the SDK the ad skip button appeared. + * + * @param videoDisplay the IMAVideoDisplay that showed the skip button + */ +- (void)videoDisplayDidShowSkip:(id)videoDisplay; + +/** + * Informs the SDK that the ad volume was changed. + * + * @param videoDisplay the IMAVideoDisplay that changed the ad volume + * @param volume the new volume of the ad being played + */ +- (void)videoDisplay:(id)videoDisplay volumeChangedTo:(NSNumber *)volume; + +/** + * Informs the SDK that the video ad progressed. + * + * @param videoDisplay the IMAVideoDisplay that progressed + * @param mediaTime the current time of the ad being played + * @param duration the total duration of the ad being played + */ +- (void)videoDisplay:(id)videoDisplay + didProgressWithMediaTime:(NSTimeInterval)mediaTime + totalTime:(NSTimeInterval)duration; + +/** + * Informs the SDK that timed metadata was received. + * + * @param videoDisplay the IMAVideoDisplay that received the timed metadata event + * @param metadata the metadata dictionary received with the timed metadata event + */ +- (void)videoDisplay:(id)videoDisplay + didReceiveTimedMetadata:(NSDictionary *)metadata; + +@optional + +/** + * Informs the SDK the video ad is buffered to |mediaTime| in seconds. + * + * @param videoDisplay the IMAVideoDisplay whose buffer was updated + * @param mediaTime the time in seconds of ad media that has been buffered. + */ +- (void)videoDisplay:(id)videoDisplay + didBufferToMediaTime:(NSTimeInterval)mediaTime; + +/** + * Informs the SDK the ad is buffered and playback is likely to keep up. + * + * @param videoDisplay the IMAVideoDisplay that is playback ready + */ +- (void)videoDisplayIsPlaybackReady:(id)videoDisplay; + +/** + * Informs the SDK the ad's media buffer is empty and playback will stall. + * + * @param videoDisplay the IMAVideoDisplay that started buffering + */ +- (void)videoDisplayDidStartBuffering:(id)videoDisplay; + +@end + +/** + * Declares a simple video display class used for ad playback. + */ +@protocol IMAVideoDisplay + +/** + * Allows the publisher to send player events to the SDK. + */ +@property(nonatomic, weak, nullable) id delegate; + +/** + * Set and get the volume for the current ad. From 0 (muted) to 1 (loudest). This volume is + * relative to device volume, not absolute. Default value is 1. + */ +@property(nonatomic, assign) float volume; + +/** + * Called to inform the VideoDisplay to load the passed URL with the subtitles for the stream. + * Subtitles are available only for dynamic ad insertion VOD streams and can be ignored + * for client side ads or dynamic ad insertion live streams. + * + * @param streamURL the URL of the stream + * @param subtitles the subtitles for the stream. Each entry in the subtitles array is an + * *NSDictionary* that corresponds to a language. Each dictionary will have a + * *language* key with a two letter language string value, a *language name* + * to specify the set of subtitles if multiple sets exist for the same language, + * and one or more subtitle key/value pairs. Here's an example NSDictionary for + * English: + * + * "language" -> "en" + * "language_name" -> "English" + * "webvtt" -> "https://somedomain.com/vtt/en.vtt" + * "ttml" -> "https://somedomain.com/ttml/en.ttml" + */ +- (void)loadStream:(NSURL *)streamURL + withSubtitles:(NSArray *> *)subtitles; + +/** + * Called to inform the VideoDisplay to play. + */ +- (void)play; + +/** + * Called to inform the VideoDisplay to pause. + */ +- (void)pause; + +/** + * Called to remove all video assets from the player. + */ +- (void)reset; + +/** + * Called to inform that the stream needs to be seeked to the given time. + * + * @param time the time to which the stream should be seeked + */ +- (void)seekStreamToTime:(NSTimeInterval)time; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAVideoStitcherLiveStreamRequest.h b/ios/IMAVideoStitcherLiveStreamRequest.h new file mode 100755 index 0000000..fd98647 --- /dev/null +++ b/ios/IMAVideoStitcherLiveStreamRequest.h @@ -0,0 +1,98 @@ +#import "IMAPictureInPictureProxy.h" +#import "IMAPodStreamRequest.h" + +NS_ASSUME_NONNULL_BEGIN + +@class IMAAdDisplayContainer; +@protocol IMAVideoDisplay; + +/** Data object describing a stream request for a Google video stitcher live serving stream. */ +@interface IMAVideoStitcherLiveStreamRequest : IMAPodStreamRequest + +/** The live stream ID for the stream. */ +@property(nonatomic, readonly) NSString *liveStreamEventID; + +/** The region for the stream. */ +@property(nonatomic, readonly) NSString *region; + +/** The project number for the stream. */ +@property(nonatomic, readonly) NSString *projectNumber; + +/** The OAuth Token for the stream. */ +@property(nonatomic, readonly) NSString *OAuthToken; + +/** + * The session options are used to set Video Stitcher-specific parameters + * for this Video Stitcher stream request. + */ +@property(nonatomic, copy, nullable) NSDictionary *videoStitcherSessionOptions; + +/** + * Initializes a stream request instance with the given network code and custom + * asset key. Uses the given ad display container to display the stream. + * + * @param liveStreamEventID The live stream ID for the stream. + * @param region The region for the stream. + * @param projectNumber The project number for the stream. + * @param OAuthToken The OAuth Token for the stream. + * @param networkCode The network code for the stream. + * @param customAssetKey The asset key for the stream. + * @param adDisplayContainer The IMAAdDisplayContainer for rendering the ad UI. + * @param videoDisplay The IMAVideoDisplay where the stream will be played. + * @param userContext The user context for tracking requests (optional) + * @param videoStitcherSessionOptions limited set of cloud session overrides (optional) + * + * @return The IMAVideoStitcherLiveStreamRequest instance. + */ +- (instancetype)initWithLiveStreamEventID:(NSString *)liveStreamEventID + region:(NSString *)region + projectNumber:(NSString *)projectNumber + OAuthToken:(NSString *)OAuthToken + networkCode:(NSString *)networkCode + customAssetKey:(NSString *)customAssetKey + adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer + videoDisplay:(id)videoDisplay + userContext:(nullable id)userContext + videoStitcherSessionOptions: + (nullable NSDictionary *)videoStitcherSessionOptions; + +/** + * Initializes a stream request instance with the given network code and custom + * asset key. Uses the given ad display container to display the stream. Uses the picture in picture + * proxy to track PIP events. + * + * @param liveStreamEventID The live stream ID for the stream. + * @param region The region for the stream. + * @param projectNumber The project number for the stream. + * @param OAuthToken The OAuth Token for the stream. + * @param networkCode The network code for the stream. + * @param customAssetKey The asset key for the stream. + * @param adDisplayContainer The IMAAdDisplayContainer for rendering the ad UI. + * @param videoDisplay The IMAVideoDisplay where the stream will be played. + * @param pictureInPictureProxy The IMAPictureInPictureProxy for tracking PIP events. + * @param userContext The user context for tracking requests (optional) + * @param videoStitcherSessionOptions limited set of cloud session overrides (optional) + * + * @return The IMAVideoStitcherLiveStreamRequest instance. + */ +- (instancetype)initWithLiveStreamEventID:(NSString *)liveStreamEventID + region:(NSString *)region + projectNumber:(NSString *)projectNumber + OAuthToken:(NSString *)OAuthToken + networkCode:(NSString *)networkCode + customAssetKey:(NSString *)customAssetKey + adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer + videoDisplay:(id)videoDisplay + pictureInPictureProxy:(nullable IMAPictureInPictureProxy *)pictureInPictureProxy + userContext:(nullable id)userContext + videoStitcherSessionOptions: + (nullable NSDictionary *)videoStitcherSessionOptions; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/IMAVideoStitcherVODStreamRequest.h b/ios/IMAVideoStitcherVODStreamRequest.h new file mode 100755 index 0000000..b6e2fde --- /dev/null +++ b/ios/IMAVideoStitcherVODStreamRequest.h @@ -0,0 +1,105 @@ +#import "IMAPictureInPictureProxy.h" +#import "IMAStreamRequest.h" + +NS_ASSUME_NONNULL_BEGIN + +@class IMAAdDisplayContainer; +@protocol IMAVideoDisplay; + +/** + * Data object describing a stream request for a Google video stitcher video on demand serving + * stream. + */ +@interface IMAVideoStitcherVODStreamRequest : IMAStreamRequest + +/** The adTagURL for the stream. */ +@property(nonatomic, readonly) NSString *adTagURL; + +/** The URL of the content source for the stream. */ +@property(nonatomic, readonly) NSString *contentSourceURL; + +/** The networkCode associate with the stream. */ +@property(nonatomic, readonly) NSString *networkCode; + +/** The OAuth Token for the stream. */ +@property(nonatomic, readonly) NSString *OAuthToken; + +/** The project number for the stream. */ +@property(nonatomic, readonly) NSString *projectNumber; + +/** The region for the stream. */ +@property(nonatomic, readonly) NSString *region; + +/** + * The session options are used to set Video Stitcher-specific parameters + * for this request. + */ +@property(nonatomic, copy, nullable) NSDictionary *videoStitcherSessionOptions; + +/** + * Initializes a stream request instance with the given network code, content source url, ad tag + * url, project number, region, and OAuth token. Uses the given ad display container to display the + * stream. + * + * @param adTagURL The adTagURL for the stream. + * @param contentSourceURL The contentSourceURL for the stream. + * @param networkCode The networkCode for the stream. + * @param OAuthToken The OAuth token for the stream. + * @param projectNumber The projectNumber for the stream. + * @param region The region for the stream. + * @param adDisplayContainer The IMAAdDisplayContainer for rendering the ad UI. + * @param videoDisplay The IMAVideoDisplay where the stream will be played. + * @param userContext The user context for tracking requests (optional) + * + * @return The IMAVideoStitcherVODStreamRequest instance. + */ +- (instancetype)initWithAdTagURL:(NSString *)adTagURL + region:(NSString *)region + projectNumber:(NSString *)projectNumber + OAuthToken:(NSString *)OAuthToken + networkCode:(NSString *)networkCode + contentSourceURL:(NSString *)contentSourceURL + adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer + videoDisplay:(id)videoDisplay + userContext:(nullable id)userContext + videoStitcherSessionOptions: + (nullable NSDictionary *)videoStitcherSessionOptions; +/** + * Initializes a stream request instance with the given network code, content source url, ad tag + * url, project number, region, and OAuth token. Uses the given ad display container to display the + * stream. Uses the picture in picture proxy to track PIP events. + * + * @param adTagURL The adTagURL code for the stream. + * @param contentSourceURL The contentSourceURL code for the stream. + * @param networkCode The networkCode for the stream. + * @param OAuthToken The OAuth Token for the stream. + * @param projectNumber The projectNumber for the stream. + * @param region The region for the stream. + * @param adDisplayContainer The IMAAdDisplayContainer for rendering the ad UI. + * @param videoDisplay The IMAVideoDisplay where the stream will be played. + * @param pictureInPictureProxy The IMAPictureInPictureProxy for tracking PIP events. + * @param userContext The user context for tracking requests (optional) + * + * @return The IMAVideoStitcherVODStreamRequest instance. + */ +- (instancetype)initWithAdTagURL:(NSString *)adTagURL + region:(NSString *)region + projectNumber:(NSString *)projectNumber + OAuthToken:(NSString *)OAuthToken + networkCode:(NSString *)networkCode + contentSourceURL:(NSString *)contentSourceURL + adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer + videoDisplay:(id)videoDisplay + pictureInPictureProxy:(nullable IMAPictureInPictureProxy *)pictureInPictureProxy + userContext:(nullable id)userContext + videoStitcherSessionOptions: + (nullable NSDictionary *)videoStitcherSessionOptions; + +/** + * :nodoc: + */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/RNGoogleIMA.m b/ios/RNGoogleIMA.m index 5d4aab3..b8a1159 100644 --- a/ios/RNGoogleIMA.m +++ b/ios/RNGoogleIMA.m @@ -1,6 +1,8 @@ #import "RNGoogleIMA.h" #import "RNGoogleIMAConverters.m" #import "UIView+React.h" +#import "IMAAdDisplayContainer.h" +#import "IMAAVPlayerVideoDisplay.h" static NSString *const statusKeyPath = @"status"; static NSString *const rctVideoNativeID = @"RNGoogleIMAPlayer"; diff --git a/ios/RNGoogleIMA.xcodeproj/project.pbxproj b/ios/RNGoogleIMA.xcodeproj/project.pbxproj index 9a55623..746a237 100644 --- a/ios/RNGoogleIMA.xcodeproj/project.pbxproj +++ b/ios/RNGoogleIMA.xcodeproj/project.pbxproj @@ -26,6 +26,40 @@ /* Begin PBXFileReference section */ 134814201AA4EA6300B7C361 /* libRNGoogleIMA.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNGoogleIMA.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 33E51A2E2BF3BEA2006CD259 /* IMAVideoDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAVideoDisplay.h; sourceTree = ""; }; + 33E51A2F2BF3BEA2006CD259 /* IMASettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMASettings.h; sourceTree = ""; }; + 33E51A302BF3BEA2006CD259 /* IMALiveStreamRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMALiveStreamRequest.h; sourceTree = ""; }; + 33E51A312BF3BEA2006CD259 /* IMASecureSignals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMASecureSignals.h; sourceTree = ""; }; + 33E51A322BF3BEA2006CD259 /* IMAContentPlayhead.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAContentPlayhead.h; sourceTree = ""; }; + 33E51A332BF3BEA2006CD259 /* IMAPodVODStreamRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAPodVODStreamRequest.h; sourceTree = ""; }; + 33E51A342BF3BEA2006CD259 /* IMAAdPlaybackInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdPlaybackInfo.h; sourceTree = ""; }; + 33E51A352BF3BEA2006CD259 /* IMAAdDisplayContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdDisplayContainer.h; sourceTree = ""; }; + 33E51A362BF3BEA3006CD259 /* IMAAVPlayerContentPlayhead.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAVPlayerContentPlayhead.h; sourceTree = ""; }; + 33E51A372BF3BEA3006CD259 /* IMACuepoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMACuepoint.h; sourceTree = ""; }; + 33E51A382BF3BEA3006CD259 /* IMAAVPlayerVideoDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAVPlayerVideoDisplay.h; sourceTree = ""; }; + 33E51A392BF3BEA3006CD259 /* IMASecureSignalsAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMASecureSignalsAdapter.h; sourceTree = ""; }; + 33E51A3A2BF3BEA3006CD259 /* IMAAdsRenderingSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdsRenderingSettings.h; sourceTree = ""; }; + 33E51A3B2BF3BEA3006CD259 /* IMAAd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAd.h; sourceTree = ""; }; + 33E51A3C2BF3BEA3006CD259 /* IMAStreamManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAStreamManager.h; sourceTree = ""; }; + 33E51A3D2BF3BEA3006CD259 /* IMAUiElements.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAUiElements.h; sourceTree = ""; }; + 33E51A3E2BF3BEA3006CD259 /* IMAAdError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdError.h; sourceTree = ""; }; + 33E51A3F2BF3BEA3006CD259 /* IMAStreamRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAStreamRequest.h; sourceTree = ""; }; + 33E51A402BF3BEA3006CD259 /* IMAFriendlyObstruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAFriendlyObstruction.h; sourceTree = ""; }; + 33E51A412BF3BEA3006CD259 /* IMAVODStreamRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAVODStreamRequest.h; sourceTree = ""; }; + 33E51A422BF3BEA3006CD259 /* IMAAdEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdEvent.h; sourceTree = ""; }; + 33E51A432BF3BEA3006CD259 /* IMAVideoStitcherLiveStreamRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAVideoStitcherLiveStreamRequest.h; sourceTree = ""; }; + 33E51A442BF3BEA3006CD259 /* IMACompanionAdSlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMACompanionAdSlot.h; sourceTree = ""; }; + 33E51A452BF3BEA3006CD259 /* IMAAdsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdsManager.h; sourceTree = ""; }; + 33E51A462BF3BEA3006CD259 /* IMAAdsRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdsRequest.h; sourceTree = ""; }; + 33E51A472BF3BEA3006CD259 /* IMAPictureInPictureProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAPictureInPictureProxy.h; sourceTree = ""; }; + 33E51A482BF3BEA3006CD259 /* IMAPodStreamRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAPodStreamRequest.h; sourceTree = ""; }; + 33E51A492BF3BEA3006CD259 /* IMACompanionAd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMACompanionAd.h; sourceTree = ""; }; + 33E51A4A2BF3BEA3006CD259 /* IMAAdPodInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdPodInfo.h; sourceTree = ""; }; + 33E51A4B2BF3BEA3006CD259 /* IMAVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAVersion.h; sourceTree = ""; }; + 33E51A4C2BF3BEA3006CD259 /* IMAAdsLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdsLoader.h; sourceTree = ""; }; + 33E51A4D2BF3BEA3006CD259 /* IMAVideoStitcherVODStreamRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAVideoStitcherVODStreamRequest.h; sourceTree = ""; }; + 33E51A4E2BF3BEA3006CD259 /* GoogleInteractiveMediaAds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GoogleInteractiveMediaAds.h; sourceTree = ""; }; + 33E51A4F2BF3BEA3006CD259 /* IMAUniversalAdID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAUniversalAdID.h; sourceTree = ""; }; B14A91712321DC2A00F252FC /* RNGoogleIMAConverters.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNGoogleIMAConverters.m; sourceTree = ""; }; B14E759D2320093400E87672 /* RNGoogleIMA.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNGoogleIMA.m; sourceTree = ""; }; B14E759E2320093400E87672 /* RNGoogleIMA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNGoogleIMA.h; sourceTree = ""; }; @@ -55,6 +89,40 @@ 58B511D21A9E6C8500147676 = { isa = PBXGroup; children = ( + 33E51A4E2BF3BEA3006CD259 /* GoogleInteractiveMediaAds.h */, + 33E51A3B2BF3BEA3006CD259 /* IMAAd.h */, + 33E51A352BF3BEA2006CD259 /* IMAAdDisplayContainer.h */, + 33E51A3E2BF3BEA3006CD259 /* IMAAdError.h */, + 33E51A422BF3BEA3006CD259 /* IMAAdEvent.h */, + 33E51A342BF3BEA2006CD259 /* IMAAdPlaybackInfo.h */, + 33E51A4A2BF3BEA3006CD259 /* IMAAdPodInfo.h */, + 33E51A4C2BF3BEA3006CD259 /* IMAAdsLoader.h */, + 33E51A452BF3BEA3006CD259 /* IMAAdsManager.h */, + 33E51A3A2BF3BEA3006CD259 /* IMAAdsRenderingSettings.h */, + 33E51A462BF3BEA3006CD259 /* IMAAdsRequest.h */, + 33E51A362BF3BEA3006CD259 /* IMAAVPlayerContentPlayhead.h */, + 33E51A382BF3BEA3006CD259 /* IMAAVPlayerVideoDisplay.h */, + 33E51A492BF3BEA3006CD259 /* IMACompanionAd.h */, + 33E51A442BF3BEA3006CD259 /* IMACompanionAdSlot.h */, + 33E51A322BF3BEA2006CD259 /* IMAContentPlayhead.h */, + 33E51A372BF3BEA3006CD259 /* IMACuepoint.h */, + 33E51A402BF3BEA3006CD259 /* IMAFriendlyObstruction.h */, + 33E51A302BF3BEA2006CD259 /* IMALiveStreamRequest.h */, + 33E51A472BF3BEA3006CD259 /* IMAPictureInPictureProxy.h */, + 33E51A482BF3BEA3006CD259 /* IMAPodStreamRequest.h */, + 33E51A332BF3BEA2006CD259 /* IMAPodVODStreamRequest.h */, + 33E51A312BF3BEA2006CD259 /* IMASecureSignals.h */, + 33E51A392BF3BEA3006CD259 /* IMASecureSignalsAdapter.h */, + 33E51A2F2BF3BEA2006CD259 /* IMASettings.h */, + 33E51A3C2BF3BEA3006CD259 /* IMAStreamManager.h */, + 33E51A3F2BF3BEA3006CD259 /* IMAStreamRequest.h */, + 33E51A3D2BF3BEA3006CD259 /* IMAUiElements.h */, + 33E51A4F2BF3BEA3006CD259 /* IMAUniversalAdID.h */, + 33E51A4B2BF3BEA3006CD259 /* IMAVersion.h */, + 33E51A2E2BF3BEA2006CD259 /* IMAVideoDisplay.h */, + 33E51A432BF3BEA3006CD259 /* IMAVideoStitcherLiveStreamRequest.h */, + 33E51A4D2BF3BEA3006CD259 /* IMAVideoStitcherVODStreamRequest.h */, + 33E51A412BF3BEA3006CD259 /* IMAVODStreamRequest.h */, B14A91712321DC2A00F252FC /* RNGoogleIMAConverters.m */, B14E75DF23202AE000E87672 /* RNGoogleIMAManager.h */, B14E75E023202AE000E87672 /* RNGoogleIMAManager.m */, From fab6b0850edc3e271dd6d05781e9dc1bb4fa0ade Mon Sep 17 00:00:00 2001 From: Nikolas Vasconcelos Date: Tue, 14 May 2024 12:54:59 -0300 Subject: [PATCH 5/7] undo latest changes --- ios/GoogleInteractiveMediaAds.h | 33 ---- ios/IMAAVPlayerContentPlayhead.h | 45 ----- ios/IMAAVPlayerVideoDisplay.h | 96 ---------- ios/IMAAd.h | 197 -------------------- ios/IMAAdDisplayContainer.h | 97 ---------- ios/IMAAdError.h | 179 ------------------ ios/IMAAdEvent.h | 175 ------------------ ios/IMAAdPlaybackInfo.h | 40 ---- ios/IMAAdPodInfo.h | 66 ------- ios/IMAAdsLoader.h | 169 ----------------- ios/IMAAdsManager.h | 211 ---------------------- ios/IMAAdsRenderingSettings.h | 141 --------------- ios/IMAAdsRequest.h | 200 -------------------- ios/IMACompanionAd.h | 28 --- ios/IMACompanionAdSlot.h | 111 ------------ ios/IMAContentPlayhead.h | 37 ---- ios/IMACuepoint.h | 38 ---- ios/IMAFriendlyObstruction.h | 45 ----- ios/IMALiveStreamRequest.h | 73 -------- ios/IMAPictureInPictureProxy.h | 70 ------- ios/IMAPodStreamRequest.h | 64 ------- ios/IMAPodVODStreamRequest.h | 59 ------ ios/IMASecureSignals.h | 25 --- ios/IMASecureSignalsAdapter.h | 34 ---- ios/IMASettings.h | 94 ---------- ios/IMAStreamManager.h | 184 ------------------- ios/IMAStreamRequest.h | 107 ----------- ios/IMAUiElements.h | 30 --- ios/IMAUniversalAdID.h | 36 ---- ios/IMAVODStreamRequest.h | 80 -------- ios/IMAVersion.h | 14 -- ios/IMAVideoDisplay.h | 203 --------------------- ios/IMAVideoStitcherLiveStreamRequest.h | 98 ---------- ios/IMAVideoStitcherVODStreamRequest.h | 105 ----------- ios/RNGoogleIMA.xcodeproj/project.pbxproj | 68 ------- 35 files changed, 3252 deletions(-) delete mode 100755 ios/GoogleInteractiveMediaAds.h delete mode 100755 ios/IMAAVPlayerContentPlayhead.h delete mode 100755 ios/IMAAVPlayerVideoDisplay.h delete mode 100755 ios/IMAAd.h delete mode 100755 ios/IMAAdDisplayContainer.h delete mode 100755 ios/IMAAdError.h delete mode 100755 ios/IMAAdEvent.h delete mode 100755 ios/IMAAdPlaybackInfo.h delete mode 100755 ios/IMAAdPodInfo.h delete mode 100755 ios/IMAAdsLoader.h delete mode 100755 ios/IMAAdsManager.h delete mode 100755 ios/IMAAdsRenderingSettings.h delete mode 100755 ios/IMAAdsRequest.h delete mode 100755 ios/IMACompanionAd.h delete mode 100755 ios/IMACompanionAdSlot.h delete mode 100755 ios/IMAContentPlayhead.h delete mode 100755 ios/IMACuepoint.h delete mode 100755 ios/IMAFriendlyObstruction.h delete mode 100755 ios/IMALiveStreamRequest.h delete mode 100755 ios/IMAPictureInPictureProxy.h delete mode 100755 ios/IMAPodStreamRequest.h delete mode 100755 ios/IMAPodVODStreamRequest.h delete mode 100755 ios/IMASecureSignals.h delete mode 100755 ios/IMASecureSignalsAdapter.h delete mode 100755 ios/IMASettings.h delete mode 100755 ios/IMAStreamManager.h delete mode 100755 ios/IMAStreamRequest.h delete mode 100755 ios/IMAUiElements.h delete mode 100755 ios/IMAUniversalAdID.h delete mode 100755 ios/IMAVODStreamRequest.h delete mode 100755 ios/IMAVersion.h delete mode 100755 ios/IMAVideoDisplay.h delete mode 100755 ios/IMAVideoStitcherLiveStreamRequest.h delete mode 100755 ios/IMAVideoStitcherVODStreamRequest.h diff --git a/ios/GoogleInteractiveMediaAds.h b/ios/GoogleInteractiveMediaAds.h deleted file mode 100755 index 699a77c..0000000 --- a/ios/GoogleInteractiveMediaAds.h +++ /dev/null @@ -1,33 +0,0 @@ -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import diff --git a/ios/IMAAVPlayerContentPlayhead.h b/ios/IMAAVPlayerContentPlayhead.h deleted file mode 100755 index c912bf5..0000000 --- a/ios/IMAAVPlayerContentPlayhead.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// IMAAVPlayerContentPlayhead.h -// GoogleIMA3 -// -// Copyright (c) 2013 Google Inc. All rights reserved. -// -// Declares IMAAVPlayerContentPlayhead, a wrapper for tracking AVPlayer-based -// video players. - -#import - -#import "IMAContentPlayhead.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * An implementation of IMAContentPlayhead for AVPlayer. Use this class to - * provide content tracking if your content player of choice is an AVPlayer - * or its subclass. - */ -@interface IMAAVPlayerContentPlayhead : NSObject - -/** - * The player to track. - */ -@property(nonatomic, readonly) AVPlayer *player; - -/** - * Initializes a IMAAVPlayerContentPlayhead that tracks a player. It will attach a periodic time - * observer to the player immediately. - * - * @param player the AVPlayer to track. - * - * @return the IMAAVPlayerContentPlayhead instance - */ -- (instancetype)initWithAVPlayer:(AVPlayer *)player; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAAVPlayerVideoDisplay.h b/ios/IMAAVPlayerVideoDisplay.h deleted file mode 100755 index b3384a7..0000000 --- a/ios/IMAAVPlayerVideoDisplay.h +++ /dev/null @@ -1,96 +0,0 @@ -// -// IMAAVPlayerVideoDisplay.h -// GoogleIMA3 -// -// Copyright (c) 2013 Google Inc. All rights reserved. -// -// Declares an object that reuses an AVPlayer for both content and ad playback - -#import - -#import "IMAVideoDisplay.h" - -NS_ASSUME_NONNULL_BEGIN - -@class AVPlayer; -@class AVPlayerItem; -@class AVURLAsset; -@class IMAAVPlayerVideoDisplay; - -/** - * The key for subtitle language. - */ -extern NSString *const kIMASubtitleLanguage; - -/** - * The key for the WebVTT sidecar subtitle URL. - */ -extern NSString *const kIMASubtitleWebVTT; - -/** - * The key for the TTML sidecar subtitle URL. - */ -extern NSString *const kIMASubtitleTTML; - -/** - * A callback protocol for IMAAVPlayerVideoDisplayDelegate. - */ -@protocol IMAAVPlayerVideoDisplayDelegate - -@optional - -/** - * Called when the IMAAVPlayerVideoDisplay will load a stream for playback. Allows the publisher to - * register the AVURLAsset for Fairplay content protection before playback starts. - * - * @param playerVideoDisplay the IMAVPlayerVideoDisplay that will load the AVURLAsset. - * @param URLAsset the AVURLAsset representing the stream to be loaded. - */ -- (void)playerVideoDisplay:(IMAAVPlayerVideoDisplay *)playerVideoDisplay - willLoadStreamAsset:(AVURLAsset *)URLAsset; - -/** - * Called when the IMAAVPlayerVideoDisplay has at least partially loaded media for - * playback and the player item is loaded. Only called for dynamic ad insertion. - */ -- (void)playerVideoDisplay:(IMAAVPlayerVideoDisplay *)playerVideoDisplay - didLoadPlayerItem:(AVPlayerItem *)playerItem; - -@end - -/** - * An implementation of the IMAVideoDisplay protocol. This object is intended - * to be initialized with the content player, and will reuse the player for - * playing ads. - */ -@interface IMAAVPlayerVideoDisplay : NSObject - -/** - * Allows the publisher to receive IMAAVPlayerVideoDisplay specific events. - */ -@property(nonatomic, weak, nullable) id playerVideoDisplayDelegate; - -/** - * The subtitles for the current stream. Will be nil until the stream starts playing. - */ -@property(nonatomic, readonly, nullable) NSArray *subtitles; - -/** - * A dictionary that contains options used to customize the initialization of an @c AVURLAsset for - * stream playback. Has no effect on client-side ads. - */ -@property(nonatomic, copy, nullable) NSDictionary *streamAssetOptions; - -/** - * Creates an IMAAVPlayerVideoDisplay that will play ads in the passed in - * content player. - * - * @param player the AVPlayer instance used for playing content - * - * @return an IMAAVPlayerVideoDisplay instance - */ -- (instancetype)initWithAVPlayer:(AVPlayer *)player; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAAd.h b/ios/IMAAd.h deleted file mode 100755 index b88823e..0000000 --- a/ios/IMAAd.h +++ /dev/null @@ -1,197 +0,0 @@ -// -// IMAAd.h -// GoogleIMA3 -// -// Copyright (c) 2013 Google Inc. All rights reserved. -// -// Represents metadata of a single ad. The user can use this metadata for -// positioning nonlinear ads (isLinear, width, height), internal tracking -// (adId, adTitle) or custom behavior (traffickingParameters). - -#import - -#import "IMAAdPodInfo.h" -#import "IMACompanionAd.h" -#import "IMAUniversalAdID.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * Data object representing a single ad. - */ -@interface IMAAd : NSObject - -/** - * The ad ID as specified in the VAST response. - */ -@property(nonatomic, copy, readonly) NSString *adId; - -/** - * The ad title from the VAST response. - */ -@property(nonatomic, copy, readonly) NSString *adTitle; - -/** - * The ad description. - */ -@property(nonatomic, copy, readonly) NSString *adDescription; - -/** - * The source ad server information included in the ad response. - */ -@property(nonatomic, copy, readonly) NSString *adSystem; - -/** The companion ads specified in the VAST response when using DAI. Empty for client-side ads. */ -@property(nonatomic, copy, readonly) NSArray *companionAds; - -/** - * Content type of the currently selected creative. For linear creatives - * returns the content type of the currently selected media file. Returns - * empty string if no creative or media file is selected on this ad. - */ -@property(nonatomic, copy, readonly) NSString *contentType; - -/** - * The duration of the ad from the VAST response. - */ -@property(nonatomic, readonly) NSTimeInterval duration; - -/** - * The UI elements that will be displayed during ad - * playback. - */ - -@property(nonatomic, copy, readonly) NSArray *uiElements; - -/** - * Whether or not the ad UI will be disabled for this ad. - * :nodoc: - */ -@property(nonatomic, readonly, getter=isUiDisabled) BOOL uiDisabled; - -/** - * The width of the ad asset. For non-linear ads, this is the actual width - * of the ad representation. For linear ads, since they scale seamlessly, we - * currently return 0 for width. - */ -@property(nonatomic, readonly) NSInteger width; - -/** - * The height of the ad asset. For non-linear ads, this is the actual height - * of the ad representation. For linear ads, since they scale seamlessly, we - * currently return 0 for height. - */ -@property(nonatomic, readonly) NSInteger height; - -/** - * The width of the selected creative as specified in the VAST response. - */ -@property(nonatomic, readonly) NSInteger VASTMediaWidth; - -/** - * The height of the selected creative as specified in the VAST response. - */ -@property(nonatomic, readonly) NSInteger VASTMediaHeight; - -/** - * The bitrate of the selected creative as specified in the VAST response. - */ -@property(nonatomic, readonly) NSInteger VASTMediaBitrate; - -/** - * Specifies whether the ad is linear or non-linear. - */ -@property(nonatomic, readonly, getter=isLinear) BOOL linear; - -/** - * Specifies whether the ad is skippable. - */ -@property(nonatomic, readonly, getter=isSkippable) BOOL skippable; - -/** - * The number of seconds of playback before the ad becomes skippable. -1 is returned for non - * skippable ads or if this is unavailable. - */ -@property(nonatomic, readonly) NSTimeInterval skipTimeOffset; - -/** - * Set of ad podding properties. - */ -@property(nonatomic, readonly) IMAAdPodInfo *adPodInfo; - -/** - * String representing custom trafficking parameters from the VAST response. - */ -@property(nonatomic, copy, readonly) NSString *traffickingParameters; - -/** - * Returns the ID of the selected creative for the ad. - */ -@property(nonatomic, copy, readonly) NSString *creativeID; - -/** - * Returns the ISCI (Industry Standard Commercial Identifier) code for an ad. This - * is the Ad-ID of the selected creative in the VAST response. - */ -@property(nonatomic, copy, readonly) NSString *creativeAdID; - -/** - * The list of all UniversalAdIds of the selected creative for this ad. Returns an empty array if - * no universal ad IDs are found. - */ -@property(nonatomic, copy, readonly) NSArray *universalAdIDs; - -/** - * The UniversalAdId of the selected creative for the ad. Returns the id value or "unknown" - * if unavailable. - */ -@property(nonatomic, copy, readonly) - NSString *universalAdIdValue DEPRECATED_MSG_ATTRIBUTE("Use universalAdIDs instead."); - -/** - * The registry associated with cataloging the UniversalAdId of the selected creative for the ad. - * Returns the registry value, or "unknown" if unavailable. - */ -@property(nonatomic, copy, readonly) - NSString *universalAdIdRegistry DEPRECATED_MSG_ATTRIBUTE("Use universalAdIDs instead."); - -/** - * The advertiser name as defined by the serving party. - */ -@property(nonatomic, copy, readonly) NSString *advertiserName; - -/** - * Returns the URL associated with the survey for the given ad. - */ -@property(nonatomic, copy, readonly, nullable) NSString *surveyURL; - -/** - * Returns the first deal ID present in the wrapper chain for the current ad, - * starting from the top. - */ -@property(nonatomic, copy, readonly) NSString *dealID; - -/** - * The IDs of the ads, starting with the first wrapper ad. - */ -@property(nonatomic, copy, readonly) NSArray *wrapperAdIDs; - -/** - * The IDs of the ads' creatives, starting with the first wrapper ad. - */ -@property(nonatomic, copy, readonly) NSArray *wrapperCreativeIDs; - -/** - * Ad systems used for wrapper ads. The ad systems returned begin with the - * first wrapper ad and continue to each wrapper ad recursively. - */ -@property(nonatomic, copy, readonly) NSArray *wrapperSystems; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdDisplayContainer.h b/ios/IMAAdDisplayContainer.h deleted file mode 100755 index cf6125b..0000000 --- a/ios/IMAAdDisplayContainer.h +++ /dev/null @@ -1,97 +0,0 @@ -// -// IMAAdDisplayContainer.h -// GoogleIMA3 -// -// Copyright (c) 2014 Google Inc. All rights reserved. -// -// Declares the IMAAdDisplayContainer interface that manages the views, -// ad slots, and displays used for ad playback. - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class IMACompanionAdSlot; -@class IMAFriendlyObstruction; - -/** - * The IMAAdDisplayContainer is responsible for managing the ad container view and companion ad - * slots used for ad playback. - */ -@interface IMAAdDisplayContainer : NSObject - -/** - * View containing the video display and ad related UI. This view must be present in the view - * hierarchy in order to make ad or stream requests. - */ -@property(nonatomic, readonly) UIView *adContainer; - -/** - * View controller containing the ad container. Used to present ad UI in child view controllers. It - * must be non-nil in order to make ad or stream requests, and it must be in the view hierarchy - * before ad playback. - */ -@property(nonatomic, weak, nullable) UIViewController *adContainerViewController; - -/** The environment to focus on during an ad break. Nil if there is not currently an ad break. */ -@property(nonatomic, readonly, nullable) id focusEnvironment; - -/** List of companion ad slots. Can be nil or empty. */ -@property(nonatomic, readonly, nullable) NSArray *companionSlots; - -/** - * Initializes IMAAdDisplayContainer for rendering the ad and displaying the ad UI without any - * companion slots. - * - * @param adContainer The view where the ad will be rendered. Fills the view's bounds. - * @param adContainerViewController The view controller containing the ad container. If not provided - * here, must be set on the property before making an ads or stream request. - * - * @return A new IMAAdDisplayContainer instance - */ -- (instancetype)initWithAdContainer:(UIView *)adContainer - viewController:(nullable UIViewController *)adContainerViewController; - -/** - * Initializes IMAAdDisplayContainer for rendering the ad and displaying the ad UI. - * - * @param adContainer The view where the ad will be rendered. Fills the view's bounds. - * @param adContainerViewController The view controller containing the ad container. If not provided - * here, must be set on the property before making an ads or stream request. - * @param companionSlots The array of IMACompanionAdSlots. Can be nil or empty. - * - * @return A new IMAAdDisplayContainer instance - */ -- (instancetype)initWithAdContainer:(UIView *)adContainer - viewController:(nullable UIViewController *)adContainerViewController - companionSlots:(nullable NSArray *)companionSlots; - -/** :nodoc: */ -- (instancetype)init NS_UNAVAILABLE; - -/** - * Registers a view that overlays or obstructs this container as "friendly" for viewability - * measurement purposes. - * - * See Open Measurement - * in the IMA SDK for guidance on what is and what is not allowed to be registered. - * - * @param friendlyObstruction An obstruction to be marked as "friendly" until unregistered. - */ -- (void)registerFriendlyObstruction:(IMAFriendlyObstruction *)friendlyObstruction; - -/** Unregisters all previously registered friendly obstructions. */ -- (void)unregisterAllFriendlyObstructions; - -/** :nodoc: */ -- (void)registerVideoControlsOverlay:(UIView *)videoControlsOverlay - DEPRECATED_MSG_ATTRIBUTE("Use registerFriendlyObstruction: instead."); - -/** :nodoc: */ -- (void)unregisterAllVideoControlsOverlays DEPRECATED_MSG_ATTRIBUTE( - "Use unregisterAllFriendlyObstructions: instead."); - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdError.h b/ios/IMAAdError.h deleted file mode 100755 index 6d9e640..0000000 --- a/ios/IMAAdError.h +++ /dev/null @@ -1,179 +0,0 @@ -/*! \file IMAAdError.h - * GoogleIMA3 - * - * Copyright (c) 2013 Google Inc. All rights reserved. - * - * This file provides error codes that are raised by the SDK and - * declares the IMAAdError class. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -#pragma mark IMAErrorType - -/** - * Possible error types while loading or playing ads. - */ -typedef NS_ENUM(NSInteger, IMAErrorType) { - /** - * An unexpected error occurred while loading or playing the ads. - * This may mean that the SDK wasn't loaded properly. - */ - kIMAAdUnknownErrorType, - /** - * An error occurred while loading the ads. - */ - kIMAAdLoadingFailed, - /** - * An error occurred while playing the ads. - */ - kIMAAdPlayingFailed, -}; - -#pragma mark - IMAErrorCode - -/** - * Possible error codes raised while loading or playing ads. - */ -typedef NS_ENUM(NSInteger, IMAErrorCode) { - /** - * The ad response was not recognized as a valid VAST ad. - */ - kIMAError_VAST_MALFORMED_RESPONSE = 100, - /** - * Trafficking error. Video player received an ad type that it was not expecting and/or cannot - * display. - */ - kIMAError_VAST_TRAFFICKING_ERROR = 200, - /** - * The VAST URI provided, or a VAST URI provided in a subsequent Wrapper - * element, was either unavailable or reached a timeout, as defined by the - * video player. The timeout is 8 seconds for initial VAST requests and 4 - * seconds for each subsequent Wrapper. - */ - kIMAError_VAST_LOAD_TIMEOUT = 301, - /** - * The maximum number of VAST wrapper redirects has been reached. - */ - kIMAError_VAST_TOO_MANY_REDIRECTS = 302, - /** - * At least one VAST wrapper loaded and a subsequent wrapper or inline ad - * load has resulted in a 404 response code. - */ - kIMAError_VAST_INVALID_URL = 303, - /** - * There was an error playing the video ad. - */ - kIMAError_VIDEO_PLAY_ERROR = 400, - /** - * Failed to load media assets from a VAST response. - * The default timeout for media loading is 8 seconds. - */ - kIMAError_VAST_MEDIA_LOAD_TIMEOUT = 402, - /** - * Assets were found in the VAST ad response for linear ad, but none of them - * matched the video player's capabilities. - */ - kIMAError_VAST_LINEAR_ASSET_MISMATCH = 403, - /** - * A companion ad failed to load or render. - */ - kIMAError_COMPANION_AD_LOADING_FAILED = 603, - /** - * An unexpected error occurred and the cause is not known. Refer to the - * inner error for more information. - */ - kIMAError_UNKNOWN_ERROR = 900, - /** - * Ads list response was malformed. - */ - kIMAError_PLAYLIST_MALFORMED_RESPONSE = 1004, - /** - * There was a problem requesting ads from the server. - */ - kIMAError_FAILED_TO_REQUEST_ADS = 1005, - /** - * Listener for at least one of the required vast events was not added. - */ - kIMAError_REQUIRED_LISTENERS_NOT_ADDED = 1006, - /** - * No assets were found in the VAST ad response. - */ - kIMAError_VAST_ASSET_NOT_FOUND = 1007, - /** - * The ad slot is not visible on the page. - */ - kIMAError_ADSLOT_NOT_VISIBLE = 1008, - /** - * A VAST response containing a single <VAST> tag with no - * child tags. - */ - kIMAError_VAST_EMPTY_RESPONSE = 1009, - /** - * There was an error loading the ad. - */ - kIMAError_FAILED_LOADING_AD = 1010, - /** - * There was an error initializing the stream. - */ - kIMAError_STREAM_INITIALIZATION_FAILED = 1020, - /** - * Invalid arguments were provided to SDK methods. - */ - kIMAError_INVALID_ARGUMENTS = 1101, - /** - * Generic invalid usage of the API. - */ - kIMAError_API_ERROR = 1102, - /** - * The version of the runtime is too old. - */ - kIMAError_OS_RUNTIME_TOO_OLD = 1103, - /** - * Another VideoAdsManager is still using the video. It must be unloaded - * before another ad can play on the same element. - */ - kIMAError_VIDEO_ELEMENT_USED = 1201, - /** - * A video element was not specified where it was required. - */ - kIMAError_VIDEO_ELEMENT_REQUIRED = 1202, - /** - * Content playhead was not passed in, but list of ads has been returned - * from the server. - */ - kIMAError_CONTENT_PLAYHEAD_MISSING = 1205, -}; - -#pragma mark - IMAAdError - -/** - * Surfaces an error that occurred during ad loading or playing. - */ -@interface IMAAdError : NSObject - -/** - * The type of error that occurred during ad loading or ad playing. - */ -@property(nonatomic, readonly) IMAErrorType type; - -/** - * The error code for obtaining more specific information about the error. - */ -@property(nonatomic, readonly) IMAErrorCode code; - -/** - * A brief description about the error. - */ -@property(nonatomic, copy, readonly, nullable) NSString *message; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdEvent.h b/ios/IMAAdEvent.h deleted file mode 100755 index 22de21d..0000000 --- a/ios/IMAAdEvent.h +++ /dev/null @@ -1,175 +0,0 @@ -/*! \file IMAAdEvent.h - * GoogleIMA3 - * - * Copyright (c) 2013 Google Inc. All rights reserved. - * - * Defines a data object used to convey information during ad playback. - * This object is sent to the IMAAdsManager delegate. - */ - -#import - -#import "IMAAd.h" - -NS_ASSUME_NONNULL_BEGIN - -#pragma mark IMAAdEventType - -/** - * Different event types sent by the IMAAdsManager to its delegate. - */ -typedef NS_ENUM(NSInteger, IMAAdEventType) { - /** - * Ad break ready. - */ - kIMAAdEvent_AD_BREAK_READY, - /** - * Ad break will not play back any ads. - */ - kIMAAdEvent_AD_BREAK_FETCH_ERROR, - /** - * Fired the first time each ad break ends. Applications must reenable seeking - * when this occurs (only used for dynamic ad insertion). - */ - kIMAAdEvent_AD_BREAK_ENDED, - /** - * Fired first time each ad break begins playback. If an ad break is watched - * subsequent times this will not be fired. Applications must disable seeking - * when this occurs (only used for dynamic ad insertion). - */ - kIMAAdEvent_AD_BREAK_STARTED, - /** - * Fired every time the stream switches from advertising or slate to content. - * This will be fired even when an ad is played a second time or when seeking - * into an ad (only used for dynamic ad insertion). - */ - kIMAAdEvent_AD_PERIOD_ENDED, - /** - * Fired every time the stream switches from content to advertising or slate. - * This will be fired even when an ad is played a second time or when seeking - * into an ad (only used for dynamic ad insertion). - */ - kIMAAdEvent_AD_PERIOD_STARTED, - /** - * All valid ads managed by the ads manager have completed or the ad response - * did not return any valid ads. - */ - kIMAAdEvent_ALL_ADS_COMPLETED, - /** - * Ad clicked. - */ - kIMAAdEvent_CLICKED, - /** - * Single ad has finished. - */ - kIMAAdEvent_COMPLETE, - /** - * Cuepoints changed for VOD stream (only used for dynamic ad insertion). - * For this event, the IMAAdEvent.adData property contains a list of - * IMACuepoints at IMAAdEvent.adData[@"cuepoints"]. - */ - kIMAAdEvent_CUEPOINTS_CHANGED, - /** - * The user has closed the icon fallback image dialog. This may be a good time to resume ad - * playback, which the SDK autopaused on icon tap. This event only fires for tvOS. - */ - kIMAAdEvent_ICON_FALLBACK_IMAGE_CLOSED, - /** - * The user has tapped an ad icon. On iOS, the SDK will navigate to the landing page. On tvOS, the - * SDK will present a modal dialog containing the VAST icon fallback image. - */ - kIMAAdEvent_ICON_TAPPED, - /** - * First quartile of a linear ad was reached. - */ - kIMAAdEvent_FIRST_QUARTILE, - /** - * An ad was loaded. - */ - kIMAAdEvent_LOADED, - /** - * A log event for the ads being played. These are typically non fatal errors. - */ - kIMAAdEvent_LOG, - /** - * Midpoint of a linear ad was reached. - */ - kIMAAdEvent_MIDPOINT, - /** - * Ad paused. - */ - kIMAAdEvent_PAUSE, - /** - * Ad resumed. - */ - kIMAAdEvent_RESUME, - /** - * Ad has skipped. - */ - kIMAAdEvent_SKIPPED, - /** - * Ad has started. - */ - kIMAAdEvent_STARTED, - /** - * Stream request has loaded (only used for dynamic ad insertion). - */ - kIMAAdEvent_STREAM_LOADED, - /** - * Stream has started playing (only used for dynamic ad insertion). Start - * Picture-in-Picture here if applicable. - */ - kIMAAdEvent_STREAM_STARTED, - /** - * Ad tapped. - */ - kIMAAdEvent_TAPPED, - /** - * Third quartile of a linear ad was reached. - */ - kIMAAdEvent_THIRD_QUARTILE -}; - -#pragma mark - Ad Data Keys - -/** - * The key for the time in seconds when the AD_BREAK_READY event fired. - */ -extern NSString *const kIMAAdBreakTime; - -#pragma mark - IMAAdEvent - -/** - * Simple data class used to transport ad playback information. - */ -@interface IMAAdEvent : NSObject - -/** - * Type of the event. - */ -@property(nonatomic, readonly) IMAAdEventType type; - -/** - * Stringified type of the event. - */ -@property(nonatomic, copy, readonly) NSString *typeString; - -/** - * The current ad that is playing or just played. This will be nil except for - * events where an ad is available (start, quartiles, midpoint, complete, and tap). - */ -@property(nonatomic, readonly, nullable) IMAAd *ad; - -/** - * Extra data about the ad. - */ -@property(nonatomic, copy, readonly, nullable) NSDictionary *adData; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdPlaybackInfo.h b/ios/IMAAdPlaybackInfo.h deleted file mode 100755 index d7feab1..0000000 --- a/ios/IMAAdPlaybackInfo.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// IMAAdPlaybackInfo.h -// GoogleIMA3 -// -// Copyright (c) 2014 Google Inc. All rights reserved. -// -// Defines a protocol for providing ad playback information. - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Groups various properties of the ad player. - */ -@protocol IMAAdPlaybackInfo - -/** - * The current media time of the ad, or 0 if no ad loaded. - */ -@property(nonatomic, readonly) NSTimeInterval currentMediaTime; - -/** - * The total media time of the ad, or 0 if no ad loaded. - */ -@property(nonatomic, readonly) NSTimeInterval totalMediaTime; - -/** - * The buffered media time of the ad, or 0 if no ad loaded. - */ -@property(nonatomic, readonly) NSTimeInterval bufferedMediaTime; - -/** - * Whether or not the ad is currently playing. - */ -@property(nonatomic, readonly, getter=isPlaying) BOOL playing; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdPodInfo.h b/ios/IMAAdPodInfo.h deleted file mode 100755 index f06cd48..0000000 --- a/ios/IMAAdPodInfo.h +++ /dev/null @@ -1,66 +0,0 @@ -// -// IMAAdPodInfo.h -// GoogleIMA3 -// -// Copyright (c) 2013 Google Inc. All rights reserved. -// -// Represents podding metadata for a single ad. - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Simple data object containing podding metadata. - */ -@interface IMAAdPodInfo : NSObject - -/** - * Total number of ads in the pod this ad belongs to. Will be 1 for standalone ads. - */ -@property(nonatomic, readonly) NSInteger totalAds; - -/** - * The position of this ad within an ad pod. Will be 1 for standalone ads. - */ -@property(nonatomic, readonly) NSInteger adPosition; - -/** - * Specifies whether the ad is a bumper. Bumpers are short videos used to open - * and close ad breaks. - */ -@property(nonatomic, readonly) BOOL isBumper; - -/** - * Client side: Returns the index of the ad pod. For a preroll pod, returns 0. - * For midrolls, returns 1, 2,..., N. For a postroll pod, returns -1. Defaults - * to 0 if this ad is not part of a pod, or this pod is not part of a playlist. - * DAI live stream: Returns the index of the ad pod. For a preroll pod, returns - * 0. For midrolls, returns the break ID. Returns -2 if pod index cannot be - * determined (internal error). - * DAI VOD: Returns the index of the ad pod. For a preroll pod, returns 0. For - * midrolls, returns 1, 2,...,N. For a postroll pod, returns N+1...N+X. - * Defaults to 0 if this ad is not part of a pod, or this pod is not part of a - * playlist. - */ -@property(nonatomic, readonly) NSInteger podIndex; - -/** - * The position of the pod in the content in seconds. Pre-roll returns 0, - * post-roll returns -1 and mid-rolls return the scheduled time of the pod. - */ -@property(nonatomic, readonly) NSTimeInterval timeOffset; - -/** - * The maximum duration of the pod in seconds. For unknown duration, -1 is returned. - */ -@property(nonatomic, readonly) NSTimeInterval maxDuration; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdsLoader.h b/ios/IMAAdsLoader.h deleted file mode 100755 index 0ebc318..0000000 --- a/ios/IMAAdsLoader.h +++ /dev/null @@ -1,169 +0,0 @@ -// -// IMAAdsLoader.h -// GoogleIMA3 -// -// Copyright (c) 2013 Google Inc. All rights reserved. -// -// Declares a set of classes used when loading ads. - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class IMAAdError; -@class IMAAdsLoader; -@class IMAAdsManager; -@class IMAStreamManager; -@class IMAAdsRequest; -@class IMAStreamRequest; -@class IMASettings; - -#pragma mark - IMAAdsLoadedData - -/** - * Ad data that is returned when the ads loader loads the ad. - */ -@interface IMAAdsLoadedData : NSObject - -/** - * The ads manager instance created by the ads loader. - * Will be nil when using dynamic ad insertion. - */ -@property(nonatomic, readonly, nullable) IMAAdsManager *adsManager; - -/** - * The stream manager instance created by the ads loader. - * Will be nil when requesting ads client side. - */ -@property(nonatomic, readonly, nullable) IMAStreamManager *streamManager; - -/** - * The user context specified in the ads request. - */ -@property(nonatomic, readonly, nullable) id userContext; - -@end - -#pragma mark - IMAAdLoadingErrorData - -/** - * Ad error data that is returned when the ads loader fails to load the ad. - */ -@interface IMAAdLoadingErrorData : NSObject - -/** - * The ad error that occurred while loading the ad. - */ -@property(nonatomic, readonly) IMAAdError *adError; - -/** - * The user context specified in the ads request. - */ -@property(nonatomic, readonly, nullable) id userContext; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -#pragma mark - IMAAdsLoaderDelegate - -/** - * Delegate object that receives state change callbacks from IMAAdsLoader. - */ -@protocol IMAAdsLoaderDelegate - -/** - * Called when ads are successfully loaded from the ad servers by the loader. - * - * @param loader the IMAAdsLoader that received the loaded ad data - * @param adsLoadedData the IMAAdsLoadedData instance containing ad data - */ -- (void)adsLoader:(IMAAdsLoader *)loader adsLoadedWithData:(IMAAdsLoadedData *)adsLoadedData; - -/** - * Error reported by the ads loader when loading or requesting an ad fails. - * - * @param loader the IMAAdsLoader that received the error - * @param adErrorData the IMAAdLoadingErrorData instance with error information - */ -- (void)adsLoader:(IMAAdsLoader *)loader failedWithErrorData:(IMAAdLoadingErrorData *)adErrorData; - -@end - -#pragma mark - IMAAdsLoader - -/** - * The IMAAdsLoader class allows the requesting of ads from the ad server. - * Use the delegate to receive the loaded ads or loading error - * in case of failure. - */ -@interface IMAAdsLoader : NSObject - -/** - * SDK-wide settings. Note that certain settings will only be evaluated during initialization of - * the adsLoader. - */ -@property(nonatomic, copy, readonly) IMASettings *settings; - -/** - * Delegate that receives IMAAdsLoaderDelegate callbacks. - */ -@property(nonatomic, weak, nullable) id delegate; - -/** - * Returns the SDK version. - * - * @return the SDK version - */ -+ (NSString *)sdkVersion; - -/** - * Initializes an IMAAdsLoader with specific settings. The loader takes 1-2 seconds to setup once - * initialized, therefore reusing a single instance of the ads loader is encouraged to minimize ad - * request times. - * - * @param settings the IMASettings to use for SDK wide settings. Uses defaults when nil. - * - * @return an IMAAdsLoader instance with given IMASettings - */ -- (instancetype)initWithSettings:(nullable IMASettings *)settings; - -/** - * Initializes the IMAAdsLoader with default settings. The loader takes 1-2 seconds to setup once - * initialized, therefore reusing a single instance of the ads loader is encouraged to minimize ad - * request times. - * - * @return an IMAAdsLoader instance with default IMASettings - */ -- (instancetype)init; - -/** - * Request ads from the ad server. The loader takes 1-2 seconds to setup on init and become ready - * to make ad requests. So reusing the same IMAAdsLoader instance is encouraged when making ad - * requests in order to minimize ad request times. - * - * @param request the IMAAdsRequest. If it was created for use with Picture-in-Picture, this - * IMAAdsLoader instance's IMASettings must have backround playback enabled - */ -- (void)requestAdsWithRequest:(IMAAdsRequest *)request; - -/** - * Request a stream with ads inserted dynamically. Reusing the same IMAAdsLoader instance is - * encouraged when making stream requests in order to minimize stream request latency. - * - * @param request the stream request - */ -- (void)requestStreamWithRequest:(IMAStreamRequest *)request; - -/** - * Signal to the SDK that the content has completed. The SDK will play - * post-rolls at this time, if any are scheduled. - */ -- (void)contentComplete; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdsManager.h b/ios/IMAAdsManager.h deleted file mode 100755 index 518ddb1..0000000 --- a/ios/IMAAdsManager.h +++ /dev/null @@ -1,211 +0,0 @@ -// -// IMAAdsManager.h -// GoogleIMA3 -// -// Copyright (c) 2013 Google Inc. All rights reserved. -// -// Declares IMAAdsManager interface that manages ad playback. -// The interface represents an abstract API. There can be one or more ads -// managed by a single ads manager. -// The implementing code should respond to the callbacks as defined in -// IMAAdsManagerDelegate. -// -// A typical ad playback session: -// 1. Ads manager is retrieved. Delegate is set. -// 2. [adsManager initialize...]; - ad is initialized and loads. -// 3. delegate.didReceiveAdEvent is called with a kIMAAdEventLoaded event. -// 4. [adsManager start]; -// 5. delegate.adsManagerDidRequestContentPause: is called. The content -// playback should pause now. -// 6. Ad display container main view is unhidden and playback starts. -// 7. delegate.didReceiveAdEvent is called with ad events. -// 8. Ad finishes. -// 9. delegate.adsManagerDidRequestContentResume: is called. The content -// playback should resume now. -// 10. delegate.didReceiveAdEvent: is called with the -// kIMAAdEvent_ALL_ADS_COMPLETED event. -// It is possible to detach the delegate and destroy the ads manager. -// -// If multiple ads are managed by the ads manager, steps 5-9 may repeat several -// times. Step 5 will happen at times predetermined by the ads server. -// The implementing code should listen to callbacks until -// kIMAAdEvent_ALL_ADS_COMPLETED is received. - -#import - -@class IMAAdDisplayContainer; -@class IMAAdError; -@class IMAAdEvent; -@class IMAAdsRenderingSettings; - -#import "IMAAdPlaybackInfo.h" -#import "IMAContentPlayhead.h" - -NS_ASSUME_NONNULL_BEGIN - -@class IMAAdsManager; - -#pragma mark IMAAdsManagerDelegate - -/** - * A callback protocol for IMAAdsManager. - */ -@protocol IMAAdsManagerDelegate - -/** - * Called when there is an IMAAdEvent. - * - * @param adsManager the IMAAdsManager receiving the event - * @param event the IMAAdEvent received - */ -- (void)adsManager:(IMAAdsManager *)adsManager didReceiveAdEvent:(IMAAdEvent *)event; - -/** - * Called when there was an error playing the ad. - * Log the error and resume playing content. - * - * @param adsManager the IMAAdsManager that errored - * @param error the IMAAdError received - */ -- (void)adsManager:(IMAAdsManager *)adsManager didReceiveAdError:(IMAAdError *)error; - -/** - * Called when an ad is ready to play. - * The implementing code should pause the content playback and prepare the UI - * for ad playback. - * - * @param adsManager the IMAAdsManager requesting content pause - */ -- (void)adsManagerDidRequestContentPause:(IMAAdsManager *)adsManager; - -/** - * Called when an ad has finished or an error occurred during the playback. - * The implementing code should resume the content playback. - * - * @param adsManager the IMAAdsManager requesting content resume - */ -- (void)adsManagerDidRequestContentResume:(IMAAdsManager *)adsManager; - -@optional - -/** - * Called every 200ms to provide time updates for the current ad. - * - * @param adsManager the IMAAdsManager tracking ad playback - * @param mediaTime the current media time in seconds - * @param totalTime the total media length in seconds - */ -- (void)adsManager:(IMAAdsManager *)adsManager - adDidProgressToTime:(NSTimeInterval)mediaTime - totalTime:(NSTimeInterval)totalTime; - -/** - * Called when the current ad is sufficiently buffered and playback is likely - * to keep up. - * - * @param adsManager the IMAAdsManager with ad playback ready - */ -- (void)adsManagerAdPlaybackReady:(IMAAdsManager *)adsManager; - -/** - * Called when the current ad media buffer is empty and playback did stall. - * - * @param adsManager the IMAAdsManager tracking the stalled ad - */ -- (void)adsManagerAdDidStartBuffering:(IMAAdsManager *)adsManager; - -/** - * Called as the current ad media buffers. - * - * @param adsManager the IMAAdsManager tracking the ad's media buffer - * @param mediaTime the current buffered media time in seconds - */ -- (void)adsManager:(IMAAdsManager *)adsManager adDidBufferToMediaTime:(NSTimeInterval)mediaTime; - -@end - -#pragma mark - IMAAdsManager - -/** - * The IMAAdsManager class is responsible for playing ads. - */ -@interface IMAAdsManager : NSObject - -/** - * The IMAAdsManagerDelegate to notify with events during ad playback. - */ -@property(nonatomic, weak, nullable) NSObject *delegate; - -/** - * List of content time offsets at which ad breaks are scheduled. - * Array of NSNumber double values in seconds. - * Empty NSArray for single ads or if no ad breaks are scheduled. - */ -@property(nonatomic, copy, readonly) NSArray *adCuePoints; - -/** - * Groups various properties about the linear ad playback. - */ -@property(nonatomic, readonly) id adPlaybackInfo; - -/** - * Set and get the volume for the current ad. From 0 (muted) to 1 (loudest). This volume is - * relative to device volume, not absolute. Default value is 1. - */ -@property(nonatomic, assign) float volume; - -/** - * Initializes and loads the ad. - * - * @param adsRenderingSettings the IMAAdsRenderingSettings. Pass in to influence ad rendering. - * Use nil to default to standard rendering. - */ -- (void)initializeWithAdsRenderingSettings:(nullable IMAAdsRenderingSettings *)adsRenderingSettings; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -/** - * Starts advertisement playback. - */ -- (void)start; - -/** - * Pauses advertisement. - */ -- (void)pause; - -/** - * Resumes the advertisement. - */ -- (void)resume; - -/** - * Skips the advertisement if the ad is skippable and the skip offset has been reached. - * IMAAdsManager.skip() only skips ads if IMA does not render the 'Skip ad' button. - */ -- (void)skip; - -/** - * Performs a clickthrough on the advertisement if the UI was successfully disabled using - * AdsRenderingSettings.disableUi. - * :nodoc: - */ -- (void)clicked; - -/** - * Causes the ads manager to stop the ad and clean its internal state. - */ -- (void)destroy; - -/** - * If an ad break is currently playing, discard it and resume content. - * Otherwise, ignore the next scheduled ad break. - */ -- (void)discardAdBreak; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdsRenderingSettings.h b/ios/IMAAdsRenderingSettings.h deleted file mode 100755 index 535f61d..0000000 --- a/ios/IMAAdsRenderingSettings.h +++ /dev/null @@ -1,141 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * The default value of |bitrate property|, causes the effective bitrate to - * be automatically selected. - */ -extern const NSInteger kIMAAutodetectBitrate; - -#pragma mark IMALinkOpenerDelegate - -/** - * Signals that a link has been opened/closed. - * For an external app (Mobile Safari/App deep link), the delegate is only notified - * before opening. - */ -@protocol IMALinkOpenerDelegate - -@optional - -/** - * Called when Safari or app deep link is about to be opened. - * - * @param linkOpener the receiving object - */ -- (void)linkOpenerWillOpenExternalApplication:(NSObject *)linkOpener; - -/** - * Called before in-app browser/app store opens. - * - * @param linkOpener the receiving object. - */ -- (void)linkOpenerWillOpenInAppLink:(NSObject *)linkOpener; - -/** - * Called when the in app browser/app-store is shown on the screen. - * - * @param linkOpener the receiving object - */ -- (void)linkOpenerDidOpenInAppLink:(NSObject *)linkOpener; - -/** - * Called when in-app browser/app-store is about to close. - * - * @param linkOpener the receiving object - */ -- (void)linkOpenerWillCloseInAppLink:(NSObject *)linkOpener; - -/** - * Called when in-app browser/app-store finishes closing. - * - * @param linkOpener the receiving object - */ -- (void)linkOpenerDidCloseInAppLink:(NSObject *)linkOpener; - -@end - -#pragma mark - IMAAdsRenderingSettings - -/** - * Set of properties that influence how ads are rendered. - */ -@interface IMAAdsRenderingSettings : NSObject - -/** - * If specified, the SDK will play the media with MIME type on the list. - * List of strings specifying the MIME types. When empty, the SDK will - * use its default list of MIME types supported on iOS. - * Example: @[ @"video/mp4", @"application/x-mpegURL" ] - * The property is an empty array by default. - */ -@property(nonatomic, copy, nullable) NSArray *mimeTypes; - -/** - * Maximum recommended bitrate. The value is in kbit/s. - * SDK will pick media with bitrate below the specified max, or the closest - * bitrate if there is no media with smaller bitrate found. - * Default value, |kIMAAutodetectBitrate|, means the bitrate will be selected - * by the SDK, using the currently detected network speed (cellular or Wi-Fi). - */ -@property(nonatomic) NSInteger bitrate; - -/** - * Timeout (in seconds) when loading a video ad media file. If loading takes - * longer than this timeout, the ad playback is canceled and the next ad in the - * pod plays, if available. Use -1 for the default of 8 seconds. - */ -@property(nonatomic) NSTimeInterval loadVideoTimeout; - -/** - * For VMAP and ad rules playlists, only play ad breaks scheduled after this time (in seconds). - * This setting is strictly after the specified time. For example, setting playAdsAfterTime to - * 15 will ignore an ad break scheduled to play at 15s. - */ -@property(nonatomic) NSTimeInterval playAdsAfterTime; - -/** - * Specifies the list of UI elements that should be visible. - * This property may be ignored for AdSense/AdX ads. For valid values, see - * IMAUiElementType. This field - * is ignored on tvOS, where UI elements are unavailable. - */ -@property(nonatomic, copy, nullable) NSArray *uiElements; - -/** - * Whether or not to disable ad UI for non TrueView ads. Check Ad.getDisableUi to check if this - * request was honored. Default is false. - * :nodoc: - */ -@property(nonatomic) BOOL disableUi; - -/** - * Whether or not the SDK will preload ad media. Default is YES. - */ -@property(nonatomic) BOOL enablePreloading; - -/** - * Specifies the optional UIViewController that will be used to open links in-app. - * When nil, tapping the video ad "Learn More" button or companion ads - * will result in opening Safari browser. Setting this allows the SDK to open links in-app. This - * field is ignored on tvOS, where Safari is not available. - */ -@property(nonatomic, weak, nullable) UIViewController *linkOpenerPresentingController; - -/** - * The IMALinkOpenerDelegate to be notified when a link is opened/closed. - * Web links are unavailable on tvOS, but this delegate will be used to notify for deep links. - */ -@property(nonatomic, weak, nullable) id linkOpenerDelegate; - -/** - * Toggle this to allow web links to open externally. - * Default is false, ignored if @c linkOpenerPresentingController is nil. - * :nodoc: - */ -@property(nonatomic) BOOL openWebLinksExternally; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAAdsRequest.h b/ios/IMAAdsRequest.h deleted file mode 100755 index 7a9e4cc..0000000 --- a/ios/IMAAdsRequest.h +++ /dev/null @@ -1,200 +0,0 @@ -// -// IMAAdsRequest.h -// GoogleIMA3 -// -// Copyright (c) 2013 Google Inc. All rights reserved. -// -// Declares a simple ad request class. - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class IMAAdDisplayContainer; -@class IMAAVPlayerContentPlayhead; -@class IMAAVPlayerVideoDisplay; -@class IMAPictureInPictureProxy; -@class IMASecureSignals; -@protocol IMAContentPlayhead; - -/** - * Data class describing the ad request. - */ -@interface IMAAdsRequest : NSObject - -/** - * Specifies the full URL to use for ads loading from an ad server. Required - * for any adsRequest. For details on constructing the ad tag url, - * see - * Create a main ad video tag manually. - */ -@property(nonatomic, copy, readonly, nullable) NSString *adTagUrl; - -/** - * Specifies a VAST, VMAP, or ad rules response to be used instead of making a - * request through an ad tag URL. This can be useful for debugging and other situations - * in which an ad response is already available. - */ -@property(nonatomic, copy, readonly, nullable) NSString *adsResponse; - -/** - * The ad display container. - */ -@property(nonatomic, readonly) IMAAdDisplayContainer *adDisplayContainer; - -/** - * The user context. - */ -@property(nonatomic, readonly, nullable) id userContext; - -/** - * Specifies whether the player intends to start the content and ad in - * response to a user action or whether they will be automatically played. - * Changing this setting will have no impact on ad playback. - */ -@property(nonatomic) BOOL adWillAutoPlay; - -/** - * Specifies whether the player intends to start the content and ad with no volume. - * Changing this setting will have no impact on ad playback. - */ -@property(nonatomic) BOOL adWillPlayMuted; - -/** - * Specifies whether the player intends to continuously play the content videos one after - * another similar to TV broadcast. Not calling this function leaves the setting as unknown. - * Note: Changing this setting will have no impact on ad playback. - */ -@property(nonatomic) BOOL continuousPlayback; - -/** - * Specifies the duration of the content in seconds to be shown. Used in AdX requests. This - * parameter is optional. - */ -@property(nonatomic) float contentDuration; - -/** - * Specifies the keywords used to describe the content to be shown. Used in AdX requests. This - * parameter is optional. - */ -@property(nonatomic, copy, nullable) NSArray *contentKeywords; - -/** - * Specifies the title of the content to be shown. Used in AdX requests. This parameter is - * optional. - */ -@property(nonatomic, copy, nullable) NSString *contentTitle; - -/** - * Specifies the Secure Signal with custom data for this ads request. Secure Signal with custom - * data is an encrypted blob containing signals collected by the publisher and previously agreed - * upon by the publisher and bidder. The Secure Signal with custom data can be cleared out by - * passing null to this function. - */ -@property(nonatomic, strong, nullable) IMASecureSignals *secureSignals; - -/** - * Specifies the universal link to the content's screen. If provided, this parameter is passed to - * the OM SDK. See Apple - * documentation for more information. - */ -@property(nonatomic, copy, nullable) NSURL *contentURL; - -/** - * Specifies the VAST load timeout in milliseconds for the initial request and any subsequent - * wrappers. This parameter is optional and will override the default timeout. - */ -@property(nonatomic) float vastLoadTimeout; - -/** - * Specifies the maximum amount of time to wait in seconds, after calling requestAds, - * before requesting the ad tag URL. This can be used to stagger requests during a - * live-stream event, in order to mitigate spikes in the number of requests. - */ -@property(nonatomic) float liveStreamPrefetchSeconds; - -/** - * Initializes an ads request instance with the given canned ads response and ad display - * container with Picture-in-Picture support. Serial ad requests may reuse the - * same IMAAdDisplayContainer by first calling [IMAAdsManager destroy] on its - * current adsManager. Concurrent requests must use different ad containers. - * - * @param adsResponse the canned ads response - * @param adDisplayContainer the IMAAdDisplayContainer for rendering the ad UI - * @param avPlayerVideoDisplay the IMAAVPlayerVideoDisplay for rendering ads - * @param pictureInPictureProxy the IMAPictureInPictureProxy for tracking PIP events - * @param userContext the user context for tracking requests (optional) - * - * @return the IMAAdsRequest instance - */ -- (instancetype)initWithAdsResponse:(NSString *)adsResponse - adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer - avPlayerVideoDisplay:(IMAAVPlayerVideoDisplay *)avPlayerVideoDisplay - pictureInPictureProxy:(IMAPictureInPictureProxy *)pictureInPictureProxy - userContext:(nullable id)userContext API_AVAILABLE(ios(9.0), tvos(14.0)); - -/** - * Initializes an ads request instance with the given canned ads response and ad display - * container. Serial ad requests may reuse the same IMAAdDisplayContainer by - * first calling [IMAAdsManager destroy] on its current adsManager. Concurrent - * requests must use different ad containers. Does not support Picture-in-Picture. - * - * @param adsResponse the canned ads response - * @param adDisplayContainer the IMAAdDisplayContainer for rendering the ad UI - * @param contentPlayhead the IMAContentPlayhead for the content player (optional) - * @param userContext the user context for tracking requests (optional) - * - * @return the IMAAdsRequest instance - */ -- (instancetype)initWithAdsResponse:(NSString *)adsResponse - adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer - contentPlayhead:(nullable NSObject *)contentPlayhead - userContext:(nullable id)userContext NS_DESIGNATED_INITIALIZER; - -/** - * Initializes an ads request instance with the given ad tag URL and ad display - * container with Picture-in-Picture support. Serial ad requests may reuse the - * same IMAAdDisplayContainer by first calling [IMAAdsManager destroy] on its - * current adsManager. Concurrent requests must use different ad containers. - * - * @param adTagUrl the ad tag URL - * @param adDisplayContainer the IMAAdDisplayContainer for rendering the ad UI - * @param avPlayerVideoDisplay the IMAAVPlayerVideoDisplay for rendering ads - * @param pictureInPictureProxy the IMAPictureInPictureProxy for tracking PIP events - * @param userContext the user context for tracking requests (optional) - * - * @return the IMAAdsRequest instance - */ -- (instancetype)initWithAdTagUrl:(NSString *)adTagUrl - adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer - avPlayerVideoDisplay:(IMAAVPlayerVideoDisplay *)avPlayerVideoDisplay - pictureInPictureProxy:(IMAPictureInPictureProxy *)pictureInPictureProxy - userContext:(nullable id)userContext API_AVAILABLE(ios(9.0), tvos(14.0)); - -/** - * Initializes an ads request instance with the given ad tag URL and ad display - * container. Serial ad requests may reuse the same IMAAdDisplayContainer by - * first calling [IMAAdsManager destroy] on its current adsManager. Concurrent - * requests must use different ad containers. Does not support Picture-in-Picture. - * - * @param adTagUrl the ad tag URL - * @param adDisplayContainer the IMAAdDisplayContainer for rendering the ad UI - * @param contentPlayhead the IMAContentPlayhead for the content player (optional) - * @param userContext the user context for tracking requests (optional) - * - * @return the IMAAdsRequest instance - */ -- (instancetype)initWithAdTagUrl:(NSString *)adTagUrl - adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer - contentPlayhead:(nullable NSObject *)contentPlayhead - userContext:(nullable id)userContext NS_DESIGNATED_INITIALIZER; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMACompanionAd.h b/ios/IMACompanionAd.h deleted file mode 100755 index 799fe51..0000000 --- a/ios/IMACompanionAd.h +++ /dev/null @@ -1,28 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -/** An object that holds data corresponding to the companion ad. */ -@interface IMACompanionAd : NSObject - -/** The value for the resource of this companion. */ -@property(nonatomic, copy, readonly, nullable) NSString *resourceValue; - -/** The API needed to execute this ad, or nil if unavailable. */ -@property(nonatomic, copy, readonly, nullable) NSString *APIFramework; - -/** The width of the companion in pixels. 0 if unavailable. */ -@property(nonatomic, readonly) NSInteger width; - -/** The height of the companion in pixels. 0 if unavailable. */ -@property(nonatomic, readonly) NSInteger height; - -/** - * Obtain an instance from IMAAd.companionAds. - * :nodoc: - */ -- (nonnull instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMACompanionAdSlot.h b/ios/IMACompanionAdSlot.h deleted file mode 100755 index baaddbb..0000000 --- a/ios/IMACompanionAdSlot.h +++ /dev/null @@ -1,111 +0,0 @@ -// -// IMACompanionAdSlot.h -// GoogleIMA3 -// -// Copyright (c) 2013 Google Inc. All rights reserved. -// -// Declares a data class that describes a companion ad slot. - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Fluid companion ads have no fixed size, but rather adapt to fit the creative - * content they display. Set width and height to fluid size to allow companion - * slot to be filled by fluid companion ad. - */ -extern const NSInteger kIMAFluidSize; - -@class IMACompanionAdSlot; - -#pragma mark IMACompanionDelegate - -/** - * Delegate to receive events from the companion ad slot. - */ -@protocol IMACompanionDelegate - -@optional - -/** - * Called when the slot is either filled or not filled. - * - * @param slot the IMACompanionAdSlot receiving the event - * @param filled is the slot filled or not - */ -- (void)companionSlot:(IMACompanionAdSlot *)slot filled:(BOOL)filled; - -/** - * Called when the slot is clicked on by the user and will - * successfully navigate away. - * - * @param slot the IMACompanionAdSlot receiving the event - */ -- (void)companionSlotWasClicked:(IMACompanionAdSlot *)slot; - -@end - -#pragma mark - IMACompanionAdSlot - -/** - * Ad slot for companion ads. The SDK will put a subview inside the provided - * UIView container. The companion will be matched to the width and height - * provided here. This class cannot be instantiated on tvOS, where companion ads - * are not available. - */ -@interface IMACompanionAdSlot : NSObject - -/** - * The view the companion will be rendered in. Display this view in your - * application before video ad starts. - */ -@property(nonatomic, readonly) UIView *view; - -/** - * Width of the slot, in pixels. This value is sent to the DFP ad server for - * targeting. - */ -@property(nonatomic, readonly) NSInteger width; - -/** - * Height of the slot, in pixels. This value is sent to the DFP ad server for - * targeting. - */ -@property(nonatomic, readonly) NSInteger height; - -/** - * The IMACompanionDelegate for receiving events from the companion ad slot. - */ -@property(nonatomic, weak, nullable) id delegate; - -/** - * Initializes an instance of a IMACompanionAdSlot with design ad width and height. - * - * @param view the UIView that will contain the companion ad - * @param width the chosen width of the ad - * @param height the chosen height of the ad - * - * @return the IMACompanionAdSlot instance - */ -- (instancetype)initWithView:(UIView *)view - width:(NSInteger)width - height:(NSInteger)height __TVOS_UNAVAILABLE; - -/** - * Initializes an instance of a IMACompanionAdSlot with fluid size. - * - * @param view the UIView that will contain the companion ad. - * - * @return the IMACompanionAdSlot instance - */ -- (instancetype)initWithView:(UIView *)view __TVOS_UNAVAILABLE; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAContentPlayhead.h b/ios/IMAContentPlayhead.h deleted file mode 100755 index 4360949..0000000 --- a/ios/IMAContentPlayhead.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// IMAContentPlayhead.h -// GoogleIMA3 -// -// Copyright (c) 2013 Google Inc. All rights reserved. -// -// Defines protocol for wrapping content playhead used in content tracking. - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Property name used for key value observation. - */ -extern NSString *const kIMAPropertyCurrentTime; - -/** - * Defines an interface for a class that tracks video content progress and - * exposes a key value observable property |currentTime|. - * The SDK provides an implementation for tracking AVPlayer-based playback - * in the IMAAVPlayerContentPlayhead. - * Publishers can supply their own implementation by implementing this - * interface and this way support any other video playback implementation - * they might have. - */ -@protocol IMAContentPlayhead - -/** - * Reflects the current playback time in seconds for the content. - * The property is key value observable. - */ -@property(nonatomic, readonly) NSTimeInterval currentTime; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMACuepoint.h b/ios/IMACuepoint.h deleted file mode 100755 index 65e8480..0000000 --- a/ios/IMACuepoint.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// IMACuepoint.h -// GoogleIMA3_ios -// -// Represents a cuepoint with a start and end time. - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Data object representation of a cuepoint for a single ad break. - */ -@interface IMACuepoint : NSObject - -/** - * The start time of the cuepoint in seconds. - */ -@property(nonatomic, readonly) NSTimeInterval startTime; - -/** - * The end time of the cuepoint in seconds. - */ -@property(nonatomic, readonly) NSTimeInterval endTime; - -/** - * Specifies whether this cuepoint has been played. - */ -@property(nonatomic, readonly, getter=isPlayed) BOOL played; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAFriendlyObstruction.h b/ios/IMAFriendlyObstruction.h deleted file mode 100755 index 868b803..0000000 --- a/ios/IMAFriendlyObstruction.h +++ /dev/null @@ -1,45 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -/** A list of purposes for which an obstruction would be registered as friendly. */ -typedef NS_ENUM(NSUInteger, IMAFriendlyObstructionPurpose) { - IMAFriendlyObstructionPurposeMediaControls, - IMAFriendlyObstructionPurposeCloseAd, - IMAFriendlyObstructionPurposeNotVisible, - IMAFriendlyObstructionPurposeOther, -}; - -/** An obstruction that is marked as "friendly" for viewability measurement purposes. */ -@interface IMAFriendlyObstruction : NSObject - -/** The view causing the obstruction. */ -@property(nonatomic, readonly) UIView *view; - -/** The purpose for registering the obstruction as friendly. */ -@property(nonatomic, readonly) IMAFriendlyObstructionPurpose purpose; - -/** - * Optional, detailed reasoning for registering this obstruction as friendly. - * If the detailedReason is not null, it must follow the IAB - * standard by being 50 characters or less and only containing characters - * A-z, 0-9, or spaces. - */ -@property(nonatomic, readonly, nullable) NSString *detailedReason; - -/** - * Initializes a friendly obstruction. - * - * @param view The view causing the obstruction. - * @param purpose The purpose for registering the obstruction as friendly. - * @param detailedReason Optional, detailed reasoning for registering this obstruction as friendly. - * - * @return A new IMAFriendlyObstruction instance - */ -- (instancetype)initWithView:(UIView *)view - purpose:(IMAFriendlyObstructionPurpose)purpose - detailedReason:(nullable NSString *)detailedReason; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMALiveStreamRequest.h b/ios/IMALiveStreamRequest.h deleted file mode 100755 index 1b38723..0000000 --- a/ios/IMALiveStreamRequest.h +++ /dev/null @@ -1,73 +0,0 @@ -// -// IMALiveStreamRequest.h -// GoogleIMA3_ios -// -// Declares a representation of a stream request for live streams. -// -// - -#import "IMAPictureInPictureProxy.h" -#import "IMAStreamRequest.h" - -NS_ASSUME_NONNULL_BEGIN - -@class IMAAdDisplayContainer; -@protocol IMAVideoDisplay; - -/** - * Data object describing a live stream request. - */ - -@interface IMALiveStreamRequest : IMAStreamRequest - -/** - * This is used to determine which stream should be played. - * The live stream request asset key is an identifier which can be - * found in the DFP UI. - * - * @type {!string} - */ -@property(nonatomic, copy, readonly) NSString *assetKey; - -/** - * Initializes a live stream request instance with the given assetKey. Uses the given ad display - * container to display the stream. - * - * @param assetKey the stream assetKey - * @param adDisplayContainer the IMAAdDisplayContainer for rendering the ad UI - * @param videoDisplay the IMAVideoDisplay for playing the stream - * @param userContext The user context for tracking requests (optional) - * - * @return the IMALiveStreamRequest instance - */ -- (instancetype)initWithAssetKey:(NSString *)assetKey - adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer - videoDisplay:(id)videoDisplay - userContext:(nullable id)userContext; - -/** - * Initializes a live stream request instance with the given assetKey. Uses the given ad display - * container to display the stream. Uses the picture in picture proxy to track PIP events. - * - * @param assetKey the stream assetKey - * @param adDisplayContainer the IMAAdDisplayContainer for rendering the ad UI - * @param videoDisplay the IMAVideoDisplay for playing the stream - * @param pictureInPictureProxy the IMAPictureInPictureProxy for tracking PIP events - * @param userContext The user context for tracking requests (optional) - * - * @return the IMALiveStreamRequest instance - */ -- (instancetype)initWithAssetKey:(NSString *)assetKey - adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer - videoDisplay:(id)videoDisplay - pictureInPictureProxy:(nullable IMAPictureInPictureProxy *)pictureInPictureProxy - userContext:(nullable id)userContext; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAPictureInPictureProxy.h b/ios/IMAPictureInPictureProxy.h deleted file mode 100755 index d4453e9..0000000 --- a/ios/IMAPictureInPictureProxy.h +++ /dev/null @@ -1,70 +0,0 @@ -// -// IMAPictureInPictureProxy.h -// GoogleIMA3 -// -// Copyright (c) 2015 Google Inc. All rights reserved. -// -// Defines a proxy for wrapping an AVPlayerViewControllerDelegate or -// AVPictureInPictureControllerDelegate for handling Picture-in-Picture. - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol AVPlayerViewControllerDelegate; -@protocol AVPictureInPictureControllerDelegate; - -/** - * A proxy class for allowing the SDK to detect entering and exiting - * Picture-in-Picture. - * - * To use the proxy, create an instance of IMAPictureInPictureProxy with the - * Picture-in-Picture delegate as an argument, and then simply set the - * Picture-in-Picture controller's delegate to the proxy. See - * - * Picture in Picture for more details. - */ -#if TARGET_OS_IOS || (TARGET_OS_TV && __TV_OS_VERSION_MAX_ALLOWED >= 140000) -@interface IMAPictureInPictureProxy - : NSProxy -#else -@interface IMAPictureInPictureProxy : NSObject -#endif -/** - * Whether or not Picture-in-Picture is currently active. - */ -@property(nonatomic, readonly, getter=isPictureInPictureActive) BOOL pictureInPictureActive; - -/** - * Whether or not Picture-in-Picture is supported on this device. - */ -+ (BOOL)isPictureInPictureSupported; - -/** - * Instantiates an IMAPictureInPictureProxy that will proxy delegate - * messages from an AVPictureInPictureController, and forward them - * to the AVPictureInPictureControllerDelegate passed on init. - * - * @param delegate the AVPictureInPictureControllerDelegate - * - * @return an IMAPictureInPictureProxy instance - */ -- (instancetype)initWithAVPictureInPictureControllerDelegate: - (id)delegate API_AVAILABLE(ios(9.0), tvos(14.0)); - -/** - * Instantiates an IMAPictureInPictureProxy that will proxy delegate - * messages from an AVPlayerViewController, and forward them to the - * AVPlayerViewControllerDelegate passed on init. - * - * @param delegate the AVPlayerViewControllerDelegate - * - * @return an IMAPictureInPictureProxy instance - */ -- (instancetype)initWithAVPlayerViewControllerDelegate:(id)delegate - API_AVAILABLE(ios(9.0), tvos(14.0)); - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAPodStreamRequest.h b/ios/IMAPodStreamRequest.h deleted file mode 100755 index 76d68ad..0000000 --- a/ios/IMAPodStreamRequest.h +++ /dev/null @@ -1,64 +0,0 @@ -#import "IMAPictureInPictureProxy.h" -#import "IMAStreamRequest.h" - -NS_ASSUME_NONNULL_BEGIN - -@class IMAAdDisplayContainer; -@protocol IMAVideoDisplay; - -/** Data object describing a stream request for a pod serving stream. */ -@interface IMAPodStreamRequest : IMAStreamRequest - -/** The network code for the stream request. */ -@property(nonatomic, copy, readonly) NSString *networkCode; - -/** The custom asset key for the stream request. */ -@property(nonatomic, copy, readonly) NSString *customAssetKey; - -/** - * Initializes a stream request instance with the given network code and custom - * asset key. Uses the given ad display container to display the stream. - * - * @param networkCode The network code for the stream. - * @param customAssetKey The asset key for the stream. - * @param adDisplayContainer The IMAAdDisplayContainer for rendering the ad UI. - * @param videoDisplay The IMAVideoDisplay where the stream will be played. - * @param userContext The user context for tracking requests (optional) - * - * @return The IMAPodStreamRequest instance. - */ -- (instancetype)initWithNetworkCode:(NSString *)networkCode - customAssetKey:(NSString *)customAssetKey - adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer - videoDisplay:(id)videoDisplay - userContext:(nullable id)userContext; - -/** - * Initializes a stream request instance with the given network code and custom - * asset key. Uses the given ad display container to display the stream. Uses the picture in picture - * proxy to track PIP events. - * - * @param networkCode The network code for the stream. - * @param customAssetKey The asset key for the stream. - * @param adDisplayContainer The IMAAdDisplayContainer for rendering the ad UI. - * @param videoDisplay The IMAVideoDisplay where the stream will be played. - * @param pictureInPictureProxy The IMAPictureInPictureProxy for tracking PIP events. - * @param userContext The user context for tracking requests (optional) - * - * @return The IMAPodStreamRequest instance. - */ -- (instancetype)initWithNetworkCode:(NSString *)networkCode - customAssetKey:(NSString *)customAssetKey - adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer - videoDisplay:(id)videoDisplay - pictureInPictureProxy:(nullable IMAPictureInPictureProxy *)pictureInPictureProxy - userContext:(nullable id)userContext; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAPodVODStreamRequest.h b/ios/IMAPodVODStreamRequest.h deleted file mode 100755 index 368a227..0000000 --- a/ios/IMAPodVODStreamRequest.h +++ /dev/null @@ -1,59 +0,0 @@ -#import "IMAPictureInPictureProxy.h" -#import "IMAStreamRequest.h" - -NS_ASSUME_NONNULL_BEGIN - -@class IMAAdDisplayContainer; -@protocol IMAVideoDisplay; - -/** - * Data object describing a stream request for a third party stitched server-side ad insertion pod - * serving VOD stream. - */ -@interface IMAPodVODStreamRequest : IMAStreamRequest - -/** The network code for the stream request. */ -@property(nonatomic, copy, readonly) NSString *networkCode; - -/** - * Initializes a stream request instance with the given network. Uses the given ad display container - * to display the stream. - * - * @param networkCode The network code for the stream. - * @param adDisplayContainer The IMAAdDisplayContainer for rendering the ad UI. - * @param videoDisplay The IMAVideoDisplay where the stream will be played. - * @param userContext The user context for tracking requests (optional) - * - * @return The IMAPodVODStreamRequest instance. - */ -- (instancetype)initWithNetworkCode:(NSString *)networkCode - adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer - videoDisplay:(id)videoDisplay - userContext:(nullable id)userContext; - -/** - * Initializes a stream request instance with the given network code. Uses the given ad display - * container to display the stream. Uses the picture in picture proxy to track PIP events. - * - * @param networkCode The network code for the stream. - * @param adDisplayContainer The IMAAdDisplayContainer for rendering the ad UI. - * @param videoDisplay The IMAVideoDisplay where the stream will be played. - * @param pictureInPictureProxy The IMAPictureInPictureProxy for tracking PIP events. - * @param userContext The user context for tracking requests (optional) - * - * @return The IMAPodVODStreamRequest instance. - */ -- (instancetype)initWithNetworkCode:(NSString *)networkCode - adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer - videoDisplay:(id)videoDisplay - pictureInPictureProxy:(nullable IMAPictureInPictureProxy *)pictureInPictureProxy - userContext:(nullable id)userContext; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMASecureSignals.h b/ios/IMASecureSignals.h deleted file mode 100755 index 52530b3..0000000 --- a/ios/IMASecureSignals.h +++ /dev/null @@ -1,25 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -// Stores the signal data for SecureSignals. Currently used to store signal for PCS only. -@interface IMASecureSignals : NSObject - -/** - * Secure Signal with custom data sent with ads request. Secure Signal with custom - * data is an encrypted blob containing signals collected by the publisher and previously agreed - * upon by the publisher and bidder。 - */ - -@property(nonatomic, copy, readonly) NSString *customData; - -- (instancetype)initWithCustomData:(NSString *)customData NS_DESIGNATED_INITIALIZER; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMASecureSignalsAdapter.h b/ios/IMASecureSignalsAdapter.h deleted file mode 100755 index 08de9f9..0000000 --- a/ios/IMASecureSignalsAdapter.h +++ /dev/null @@ -1,34 +0,0 @@ -#import - -@class IMAVersion; - -NS_ASSUME_NONNULL_BEGIN - -/** Completion handler for signal generation. Returns either signals or an error object. */ -typedef void (^IMASignalCompletionHandler)(NSString *_Nullable signals, NSError *_Nullable error); - -/** Adapter that provides secure signal(3rd party signal only) to the IMA SDK to be included in an - * auction. */ -@protocol IMASecureSignalsAdapter - -/** Initializes the Secure Signal adapter. */ -- (nullable instancetype)init; - -/** The version of the adapter. */ -+ (IMAVersion *)adapterVersion; - -/** The version of the ad SDK. */ -+ (IMAVersion *)adSDKVersion; - -/** - * Asks the receiver for encrypted signals. Signals are provided to the 3PAS at request time. The - * receiver must call @c completionHandler with signals or an error. - * This method is called on a non-main thread. The receiver should avoid using the main thread to - * prevent signal collection timeouts. - * @param completion The block to call when signal collection is complete. - */ -- (void)collectSignalsWithCompletion:(IMASignalCompletionHandler)completion; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMASettings.h b/ios/IMASettings.h deleted file mode 100755 index 01cc589..0000000 --- a/ios/IMASettings.h +++ /dev/null @@ -1,94 +0,0 @@ -// -// IMASettings.h -// GoogleIMA3 -// -// Copyright (c) 2015 Google Inc. All rights reserved. -// -// Stores SDK wide settings. Only instantiated in the SDK. - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * The IMASettings class stores SDK wide settings. - */ -@interface IMASettings : NSObject - -/** - * Publisher Provided Identification (PPID) sent with ads request. - */ -@property(nonatomic, copy, nullable) NSString *ppid; - -/** - * Language specification used for localization. |Language| must be formatted as - * a canonicalized IETF BCP 47 language identifier such as would be returned by - * [NSLocale preferredLanguages]. Setting this property after it has been sent - * to the IMAAdsLoader will be ignored and a warning will be logged. - */ -@property(nonatomic, copy) NSString *language; - -/** - * Specifies maximum number of redirects after which subsequent redirects will - * be denied, and the ad load aborted. The number of redirects directly affects - * latency and thus user experience. This applies to all VAST wrapper ads. If - * the number of redirects exceeds |maxRedirects|, the ad request will fail with - * error code 302. The default value is 4. - */ -@property(nonatomic) NSUInteger maxRedirects; - -/** - * Feature flags and their states. Used to control experimental features. - */ -@property(nonatomic, copy) NSDictionary *featureFlags; - -/** - * Enable background audio playback for the SDK. The default value is NO. - */ -@property(nonatomic) BOOL enableBackgroundPlayback; - -/** - * Specifies whether to automatically play VMAP and ad rules ad breaks. The - * default value is YES. - */ -@property(nonatomic) BOOL autoPlayAdBreaks; - -/** - * Specifies whether to update the MPNowPlayingInfoCenter content with the - * title "Advertisement". If disabled, MPNowPlayingInfoCenter is untouched. - * The default value is NO. - */ -@property(nonatomic) BOOL disableNowPlayingInfo; - -/** - * The partner specified video player that is integrating with the SDK. - */ -@property(nonatomic, copy, nullable) NSString *playerType; - -/** - * The partner specified player version that is integrating with the SDK. - */ -@property(nonatomic, copy, nullable) NSString *playerVersion; - -/** - * The session ID to identify a single user session. This should be a UUID. It - * is used exclusively for frequency capping across the user session. - */ -@property(nonatomic, copy, nullable) NSString *sessionID; - -/** - * Controls whether Same App Key is enabled. The value set persists across app sessions. The key is - * enabled by default. - */ -@property(nonatomic) BOOL sameAppKeyEnabled __TVOS_UNAVAILABLE; - -/** - * Toggles debug mode which will output detailed log information to the console. - * Debug mode should be disabled in Release and will display a watermark when - * enabled. The default value is NO. - */ -@property(nonatomic) BOOL enableDebugMode; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAStreamManager.h b/ios/IMAStreamManager.h deleted file mode 100755 index 616b251..0000000 --- a/ios/IMAStreamManager.h +++ /dev/null @@ -1,184 +0,0 @@ -// -// IMAStreamManager.h -// GoogleIMA3 -// -// Copyright (c) 2015 Google Inc. All rights reserved. -// -// Declares IMAStreamManager interface that manages stream playback. -// The interface represents an abstract API. There can be only one stream managed by a single -// stream manager. -// The implementing code should respond to the callbacks as defined in IMAStreamManagerDelegate. -// -// A typical stream playback session: -// 1. Stream manager is retrieved. Delegate is set. -// 2. Stream playback will meanwhile start because of the adsLoader requestStream call. -// 3. delegate.didReceiveAdEvent: is called with a kIMAAdBreakStarted event. -// 4. Publisher should now hide content controls or disable seeking. Ad is now playing -// 5. delegate.didReceiveAdEvent: is called with a kIMAAdStart event. This event comes with -// information about the ad. -// 6. delegate.didReceiveAdEvent is called with ad events like quartiles, midpoint and complete. -// 7. Ad break finishes and delegate.didReceiveAdEvent is called with a kIMAAdBreakEnded event. -// 8. Publisher should now show content controls or reenable seeking. Content is now playing. -// playback should resume now. -// It is possible to detach the delegate and destroy the ads manager. -// -// Steps 3-8 may repeat several times for the same stream if there are multiple ads inserted in -// the stream. - -#import - -#import "IMAAdError.h" -#import "IMAAdEvent.h" -#import "IMAAdPlaybackInfo.h" -#import "IMAAdsRenderingSettings.h" -#import "IMAContentPlayhead.h" - -NS_ASSUME_NONNULL_BEGIN - -@class IMACuepoint; -@class IMAStreamManager; - -#pragma mark IMAStreamManagerDelegate - -/** - * A callback protocol for IMAStreamManager. - */ -@protocol IMAStreamManagerDelegate - -/** - * Called when there is an IMAAdEvent. - * - * @param streamManager the IMAStreamManager receiving the event - * @param event the IMAAdEvent received - */ -- (void)streamManager:(IMAStreamManager *)streamManager didReceiveAdEvent:(IMAAdEvent *)event; - -/** - * Called when there is an IMAAdEvent. - * - * @param streamManager the IMAStreamManager receiving the error - * @param error the IMAAdError received - */ -- (void)streamManager:(IMAStreamManager *)streamManager didReceiveAdError:(IMAAdError *)error; - -@optional - -/** - * Called when the ad is playing to give updates about ad progress. - * - * @param streamManager the IMAStreamManager tracking ad playback - * @param time the current ad playback time in seconds - * @param adDuration the total duration of the current ad in seconds - * @param adPosition the ad position of the current ad in the current ad break - * @param totalAds the total number of ads in the current ad break - * @param adBreakDuration the total duration of the current ad break in seconds - * @param adPeriodDuration the total duration of the current ad period in seconds. This includes ads - * duration plus slate. - */ -- (void)streamManager:(IMAStreamManager *)streamManager - adDidProgressToTime:(NSTimeInterval)time - adDuration:(NSTimeInterval)adDuration - adPosition:(NSInteger)adPosition - totalAds:(NSInteger)totalAds - adBreakDuration:(NSTimeInterval)adBreakDuration - adPeriodDuration:(NSTimeInterval)adPeriodDuration; - -@end - -#pragma mark - IMAStreamManager - -/** - * The IMAStreamManager class is responsible for playing streams. - */ -@interface IMAStreamManager : NSObject - -/** - * The IMAStreamManagerDelegate to notify with events during stream playback. - */ -@property(nonatomic, weak, nullable) NSObject *delegate; - -/** - * Identifier used during dynamic ad insertion to uniquely identify a stream. This can be used in - * the Stream Activity Monitor Debug Console to debug the stream session. - */ -@property(nonatomic, copy, readonly, nullable) NSString *streamId; - -/** - * The cuepoints for the current stream, populated after @c kIMAAdEvent_CUEPOINTS_CHANGED event is - * dispatched. Will be empty for live streams. - */ -@property(nonatomic, readonly) NSArray *cuepoints; - -/** - * Initializes and loads the stream. - * - * @param adsRenderingSettings the IMAAdsRenderingSettings. Pass in to influence ad rendering. - * Use nil to default to standard rendering. - */ -- (void)initializeWithAdsRenderingSettings:(nullable IMAAdsRenderingSettings *)adsRenderingSettings; - -/** - * Returns the stream time with ads for a given content time. Returns the given content time - * for live streams. - * - * @param contentTime the content time without any ads (in seconds) - * - * @return the stream time that corresponds with the given content time once ads are inserted - */ -- (NSTimeInterval)streamTimeForContentTime:(NSTimeInterval)contentTime; - -/** - * Returns the content time without ads for a given stream time. Returns the given stream time - * for live streams. - * - * @param streamTime the stream time with inserted ads (in seconds) - * - * @return the content time that corresponds with the given stream time once ads are removed - */ -- (NSTimeInterval)contentTimeForStreamTime:(NSTimeInterval)streamTime; - -/** - * Returns the previous cuepoint for the given stream time. Returns nil if no such cuepoint exists. - * This is used to implement features like snap back, and called when the publisher detects that - * the user seeked in order to force the user to watch an ad break they may have skipped over. - * - * @param streamTime the stream time that the was seeked to. - * - * @return the previous IMACuepoint for the given stream time. - */ -- (nullable IMACuepoint *)previousCuepointForStreamTime:(NSTimeInterval)streamTime; - -/** - * Replaces all of the ad tag parameters used for upcoming ad requests for a - * live stream. - * Note that this call is a no-op for VOD streams. - * - * @param adTagParameters the new ad tag parameters for the current stream. - */ -- (void)replaceAdTagParameters:(nullable NSDictionary *)adTagParameters; - -/** - * Requests SDK to retrieve the ad metadata and then load the provided streamManifestUrl and - * streamSubtitles into the player. This should be manually triggered once the stream manifest has - * been retrieved from the third party video stitcher. Note that this is only used for Pod serving - * VOD with a third party video stitcher, and is a no-op for other stream request types. - * - * @param streamURL the manifest url for the stream with dynamic ad insertion. - * @param streamSubtitles the subtitles array for the stream. - */ -- (void)loadThirdPartyStream:(NSURL *)streamURL - streamSubtitles:(NSArray *> *)streamSubtitles; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -/** - * Cleans the stream manager's internal state for proper deallocation. - */ -- (void)destroy; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAStreamRequest.h b/ios/IMAStreamRequest.h deleted file mode 100755 index 9d9368d..0000000 --- a/ios/IMAStreamRequest.h +++ /dev/null @@ -1,107 +0,0 @@ -// -// IMAStreamRequest.h -// GoogleIMA3 -// -// Copyright (c) 2015 Google Inc. All rights reserved. -// -// Declares a simple stream request class. - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class IMAAdDisplayContainer; -@class IMASecureSignals; -@protocol IMAVideoDisplay; - -/** - * Data class describing the stream request. - */ -@interface IMAStreamRequest : NSObject - -/** - * The stream display container for displaying the ad UI. - */ -@property(nonatomic, readonly) IMAAdDisplayContainer *adDisplayContainer; - -/** - * The video display where the stream can be played. - */ -@property(nonatomic, readonly) id videoDisplay; - -/** - * The stream request API key. It's configured through the - * - * DFP Admin UI and provided to the publisher to unlock their content. - * It verifies the applications that are attempting to access the content. - */ -@property(nonatomic, copy, nullable) NSString *apiKey; - -/** - * The stream request authorization token. This is used in place of the API key for stricter - * content authorization. The publisher can control individual content streams authorized based - * on this token. - */ -@property(nonatomic, copy, nullable) NSString *authToken; - -/** - * The ID to be used to debug the stream with the stream activity monitor. This is used to provide - * a convenient way to allow publishers to find a stream log in the stream activity monitor tool. - */ -@property(nonatomic, copy, nullable) NSString *streamActivityMonitorID; - -/** - * You can override a limited set of ad tag parameters on your stream request. - * - * Supply targeting parameters to your stream provides more information. - * - * You can use the dai-ot and dai-ov parameters for stream variant preference. - * See - * Override Stream Variant Parameters for more information. - */ -@property(nonatomic, copy, nullable) NSDictionary *adTagParameters; - -/** - * The suffix that the SDK will append to the query of the stream manifest URL. Do not include the - * '?' separator at the start. The SDK will account for the existence of parameters in the URL - * already, removing existing ones that collide with ones supplied here. This suffix needs to be - * sanitized and encoded as the SDK will not do this. - */ -@property(nonatomic, copy, nullable) NSString *manifestURLSuffix; - -/** - * Specifies the universal link to the content's screen. If provided, this parameter is passed to - * the OM SDK. See Apple - * documentation for more information. - */ -@property(nonatomic, copy, nullable) NSURL *contentURL; - -/** - * Enables the addition of a nonce to the request. This is needed to transmit monetization signals - * to Google servers when ads are requested server side from a non Google server. Defaults to false. - * :nodoc: - */ -@property(nonatomic, assign) BOOL enableNonce; - -/** - * Specifies the Secure Signal with custom data for this stream request. Secure Signal with custom - * data is an encrypted blob containing signals collected by the publisher and previously agreed - * upon by the publisher and bidder. The Secure Signal with custom data can be cleared out by - * passing null to this function. - */ -@property(nonatomic, strong, nullable) IMASecureSignals *secureSignals; - -/** - * The user context. - */ -@property(nonatomic, readonly, nullable) id userContext; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAUiElements.h b/ios/IMAUiElements.h deleted file mode 100755 index 49c75f1..0000000 --- a/ios/IMAUiElements.h +++ /dev/null @@ -1,30 +0,0 @@ -/*! \file IMAUiElements.h - * GoogleIMA3 - * - * Copyright (c) 2013 Google Inc. All rights reserved. - * - * Defines an enum containing the possible UI elements that can be - * customized by the publisher during ad playback. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -#pragma mark IMAUiElementType - -/** - * Different UI elements that can be customized. - */ -typedef NS_ENUM(NSInteger, IMAUiElementType) { - /** - * Ad attribution UI element. - */ - kIMAUiElements_AD_ATTRIBUTION, - /** - * Ad countdown element. - */ - kIMAUiElements_COUNTDOWN -}; - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAUniversalAdID.h b/ios/IMAUniversalAdID.h deleted file mode 100755 index cdd99c0..0000000 --- a/ios/IMAUniversalAdID.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// IMAUniversalAdID.h -// GoogleIMA3 -// -// Copyright (c) 2019 Google Inc. All rights reserved. -// -// Represents the universal ad ID information for a single ad. - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Simple data object containing universal ad ID information. - */ -@interface IMAUniversalAdID : NSObject - -/** - * The universal ad ID value. This will be "unknown" if it isn't defined by the ad. - */ -@property(nonatomic, copy, readonly) NSString *adIDValue; - -/** - * The universal ad ID registry with which the value is registered. This will be "unknown" - * if it isn't defined by the ad. - */ -@property(nonatomic, copy, readonly) NSString *adIDRegistry; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAVODStreamRequest.h b/ios/IMAVODStreamRequest.h deleted file mode 100755 index 241c7a6..0000000 --- a/ios/IMAVODStreamRequest.h +++ /dev/null @@ -1,80 +0,0 @@ -// -// IMAVODStreamRequest.h -// GoogleIMA3_ios -// -// Declares a representation of a stream request for on-demand streams. -// - -#import "IMAStreamRequest.h" - -NS_ASSUME_NONNULL_BEGIN - -@class IMAAdDisplayContainer; -@class IMAPictureInPictureProxy; -@protocol IMAVideoDisplay; - -/** - * Data object describing a VOD stream request. - */ - -@interface IMAVODStreamRequest : IMAStreamRequest - -/** - * The stream request content source ID. This is used to determine the - * content source of the stream. - */ -@property(nonatomic, copy, readonly) NSString *contentSourceID; - -/** - * The stream request video ID. This is used to determine which specific video - * stream should be played. - */ -@property(nonatomic, copy, readonly) NSString *videoID; - -/** - * Initializes a stream request instance with the given content source ID and video ID. - * Uses the given ad display container to display the stream. This is used for on-demand streams. - * - * @param contentSourceID the content source ID for this stream - * @param videoID the video identifier for this stream - * @param adDisplayContainer the IMAAdDisplayContainer for rendering the ad UI - * @param videoDisplay the IMAVideoDisplay for playing the stream - * @param userContext The user context for tracking requests (optional) - * - * @return the IMAVODStreamRequest instance - */ -- (instancetype)initWithContentSourceID:(NSString *)contentSourceID - videoID:(NSString *)videoID - adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer - videoDisplay:(id)videoDisplay - userContext:(nullable id)userContext; - -/** - * Initializes a stream request instance with the given content source ID and video ID. - * Uses the given ad display container to display the stream. This is used for on-demand streams. - * Uses the picture in picture proxy to track PIP events. - * - * @param contentSourceID the content source ID for this stream - * @param videoID the video identifier for this stream - * @param adDisplayContainer the IMAAdDisplayContainer for rendering the ad UI - * @param videoDisplay the IMAVideoDisplay for playing the stream - * @param pictureInPictureProxy the IMAPictureInPictureProxy for tracking PIP events - * @param userContext The user context for tracking requests (optional) - * - * @return the IMAVODStreamRequest instance - */ -- (instancetype)initWithContentSourceID:(NSString *)contentSourceID - videoID:(NSString *)videoID - adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer - videoDisplay:(id)videoDisplay - pictureInPictureProxy:(nullable IMAPictureInPictureProxy *)pictureInPictureProxy - userContext:(nullable id)userContext; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAVersion.h b/ios/IMAVersion.h deleted file mode 100755 index ce2c952..0000000 --- a/ios/IMAVersion.h +++ /dev/null @@ -1,14 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface IMAVersion : NSObject -/** Major version. */ -@property(nonatomic) NSInteger majorVersion; -/** Minor version. */ -@property(nonatomic) NSInteger minorVersion; -/** Patch version. */ -@property(nonatomic) NSInteger patchVersion; -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAVideoDisplay.h b/ios/IMAVideoDisplay.h deleted file mode 100755 index 735b621..0000000 --- a/ios/IMAVideoDisplay.h +++ /dev/null @@ -1,203 +0,0 @@ -// -// IMAVideoDisplay.h -// GoogleIMA3 -// -// Copyright (c) 2015 Google Inc. All rights reserved. -// -// Declares a simple video display class used for ad playback. - -#import "IMAAdPlaybackInfo.h" - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol IMAVideoDisplay; - -/** - * Delegate object that receives state change callbacks from IMAVideoDisplay. - */ -@protocol IMAVideoDisplayDelegate - -/** - * Informs the SDK that the ad has loaded. - * - * @param videoDisplay the IMAVideoDisplay that loaded the ad - */ -- (void)videoDisplayDidLoad:(id)videoDisplay; - -/** - * Informs the SDK the ad has started playback. This must be called at most once per loadStream: - * or loadUrl: call. - * - * @param videoDisplay the IMAVideoDisplay that started ad playback - */ -- (void)videoDisplayDidStart:(id)videoDisplay; - -/** - * Informs the SDK the ad has paused. - * - * @param videoDisplay the IMAVideoDisplay that paused ad playback - */ -- (void)videoDisplayDidPause:(id)videoDisplay; - -/** - * Informs the SDK the ad has resumed playback. - * - * @param videoDisplay the IMAVideoDisplay that resumed ad playback - */ -- (void)videoDisplayDidResume:(id)videoDisplay; - -/** - * Informs the SDK the ad has completed playback. - * - * @param videoDisplay the IMAVideoDisplay that completed ad playback - */ -- (void)videoDisplayDidComplete:(id)videoDisplay; - -/** - * Informs the SDK the ad was clicked. - * - * @param videoDisplay the IMAVideoDisplay that received the ad click - */ -- (void)videoDisplayDidClick:(id)videoDisplay; - -/** - * Informs the SDK the ad playback failed due to an error. - * - * @param videoDisplay the IMAVideoDisplay that failed to play the ad - * @param error the error that caused the video display to fail to play the ad - */ -- (void)videoDisplay:(id)videoDisplay didReceiveError:(NSError *)error; - -/** - * Informs the SDK the ad was skipped. - * - * @param videoDisplay the IMAVideoDisplay that skipped the ad - */ -- (void)videoDisplayDidSkip:(id)videoDisplay; - -/** - * Informs the SDK the ad skip button appeared. - * - * @param videoDisplay the IMAVideoDisplay that showed the skip button - */ -- (void)videoDisplayDidShowSkip:(id)videoDisplay; - -/** - * Informs the SDK that the ad volume was changed. - * - * @param videoDisplay the IMAVideoDisplay that changed the ad volume - * @param volume the new volume of the ad being played - */ -- (void)videoDisplay:(id)videoDisplay volumeChangedTo:(NSNumber *)volume; - -/** - * Informs the SDK that the video ad progressed. - * - * @param videoDisplay the IMAVideoDisplay that progressed - * @param mediaTime the current time of the ad being played - * @param duration the total duration of the ad being played - */ -- (void)videoDisplay:(id)videoDisplay - didProgressWithMediaTime:(NSTimeInterval)mediaTime - totalTime:(NSTimeInterval)duration; - -/** - * Informs the SDK that timed metadata was received. - * - * @param videoDisplay the IMAVideoDisplay that received the timed metadata event - * @param metadata the metadata dictionary received with the timed metadata event - */ -- (void)videoDisplay:(id)videoDisplay - didReceiveTimedMetadata:(NSDictionary *)metadata; - -@optional - -/** - * Informs the SDK the video ad is buffered to |mediaTime| in seconds. - * - * @param videoDisplay the IMAVideoDisplay whose buffer was updated - * @param mediaTime the time in seconds of ad media that has been buffered. - */ -- (void)videoDisplay:(id)videoDisplay - didBufferToMediaTime:(NSTimeInterval)mediaTime; - -/** - * Informs the SDK the ad is buffered and playback is likely to keep up. - * - * @param videoDisplay the IMAVideoDisplay that is playback ready - */ -- (void)videoDisplayIsPlaybackReady:(id)videoDisplay; - -/** - * Informs the SDK the ad's media buffer is empty and playback will stall. - * - * @param videoDisplay the IMAVideoDisplay that started buffering - */ -- (void)videoDisplayDidStartBuffering:(id)videoDisplay; - -@end - -/** - * Declares a simple video display class used for ad playback. - */ -@protocol IMAVideoDisplay - -/** - * Allows the publisher to send player events to the SDK. - */ -@property(nonatomic, weak, nullable) id delegate; - -/** - * Set and get the volume for the current ad. From 0 (muted) to 1 (loudest). This volume is - * relative to device volume, not absolute. Default value is 1. - */ -@property(nonatomic, assign) float volume; - -/** - * Called to inform the VideoDisplay to load the passed URL with the subtitles for the stream. - * Subtitles are available only for dynamic ad insertion VOD streams and can be ignored - * for client side ads or dynamic ad insertion live streams. - * - * @param streamURL the URL of the stream - * @param subtitles the subtitles for the stream. Each entry in the subtitles array is an - * *NSDictionary* that corresponds to a language. Each dictionary will have a - * *language* key with a two letter language string value, a *language name* - * to specify the set of subtitles if multiple sets exist for the same language, - * and one or more subtitle key/value pairs. Here's an example NSDictionary for - * English: - * - * "language" -> "en" - * "language_name" -> "English" - * "webvtt" -> "https://somedomain.com/vtt/en.vtt" - * "ttml" -> "https://somedomain.com/ttml/en.ttml" - */ -- (void)loadStream:(NSURL *)streamURL - withSubtitles:(NSArray *> *)subtitles; - -/** - * Called to inform the VideoDisplay to play. - */ -- (void)play; - -/** - * Called to inform the VideoDisplay to pause. - */ -- (void)pause; - -/** - * Called to remove all video assets from the player. - */ -- (void)reset; - -/** - * Called to inform that the stream needs to be seeked to the given time. - * - * @param time the time to which the stream should be seeked - */ -- (void)seekStreamToTime:(NSTimeInterval)time; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAVideoStitcherLiveStreamRequest.h b/ios/IMAVideoStitcherLiveStreamRequest.h deleted file mode 100755 index fd98647..0000000 --- a/ios/IMAVideoStitcherLiveStreamRequest.h +++ /dev/null @@ -1,98 +0,0 @@ -#import "IMAPictureInPictureProxy.h" -#import "IMAPodStreamRequest.h" - -NS_ASSUME_NONNULL_BEGIN - -@class IMAAdDisplayContainer; -@protocol IMAVideoDisplay; - -/** Data object describing a stream request for a Google video stitcher live serving stream. */ -@interface IMAVideoStitcherLiveStreamRequest : IMAPodStreamRequest - -/** The live stream ID for the stream. */ -@property(nonatomic, readonly) NSString *liveStreamEventID; - -/** The region for the stream. */ -@property(nonatomic, readonly) NSString *region; - -/** The project number for the stream. */ -@property(nonatomic, readonly) NSString *projectNumber; - -/** The OAuth Token for the stream. */ -@property(nonatomic, readonly) NSString *OAuthToken; - -/** - * The session options are used to set Video Stitcher-specific parameters - * for this Video Stitcher stream request. - */ -@property(nonatomic, copy, nullable) NSDictionary *videoStitcherSessionOptions; - -/** - * Initializes a stream request instance with the given network code and custom - * asset key. Uses the given ad display container to display the stream. - * - * @param liveStreamEventID The live stream ID for the stream. - * @param region The region for the stream. - * @param projectNumber The project number for the stream. - * @param OAuthToken The OAuth Token for the stream. - * @param networkCode The network code for the stream. - * @param customAssetKey The asset key for the stream. - * @param adDisplayContainer The IMAAdDisplayContainer for rendering the ad UI. - * @param videoDisplay The IMAVideoDisplay where the stream will be played. - * @param userContext The user context for tracking requests (optional) - * @param videoStitcherSessionOptions limited set of cloud session overrides (optional) - * - * @return The IMAVideoStitcherLiveStreamRequest instance. - */ -- (instancetype)initWithLiveStreamEventID:(NSString *)liveStreamEventID - region:(NSString *)region - projectNumber:(NSString *)projectNumber - OAuthToken:(NSString *)OAuthToken - networkCode:(NSString *)networkCode - customAssetKey:(NSString *)customAssetKey - adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer - videoDisplay:(id)videoDisplay - userContext:(nullable id)userContext - videoStitcherSessionOptions: - (nullable NSDictionary *)videoStitcherSessionOptions; - -/** - * Initializes a stream request instance with the given network code and custom - * asset key. Uses the given ad display container to display the stream. Uses the picture in picture - * proxy to track PIP events. - * - * @param liveStreamEventID The live stream ID for the stream. - * @param region The region for the stream. - * @param projectNumber The project number for the stream. - * @param OAuthToken The OAuth Token for the stream. - * @param networkCode The network code for the stream. - * @param customAssetKey The asset key for the stream. - * @param adDisplayContainer The IMAAdDisplayContainer for rendering the ad UI. - * @param videoDisplay The IMAVideoDisplay where the stream will be played. - * @param pictureInPictureProxy The IMAPictureInPictureProxy for tracking PIP events. - * @param userContext The user context for tracking requests (optional) - * @param videoStitcherSessionOptions limited set of cloud session overrides (optional) - * - * @return The IMAVideoStitcherLiveStreamRequest instance. - */ -- (instancetype)initWithLiveStreamEventID:(NSString *)liveStreamEventID - region:(NSString *)region - projectNumber:(NSString *)projectNumber - OAuthToken:(NSString *)OAuthToken - networkCode:(NSString *)networkCode - customAssetKey:(NSString *)customAssetKey - adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer - videoDisplay:(id)videoDisplay - pictureInPictureProxy:(nullable IMAPictureInPictureProxy *)pictureInPictureProxy - userContext:(nullable id)userContext - videoStitcherSessionOptions: - (nullable NSDictionary *)videoStitcherSessionOptions; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/IMAVideoStitcherVODStreamRequest.h b/ios/IMAVideoStitcherVODStreamRequest.h deleted file mode 100755 index b6e2fde..0000000 --- a/ios/IMAVideoStitcherVODStreamRequest.h +++ /dev/null @@ -1,105 +0,0 @@ -#import "IMAPictureInPictureProxy.h" -#import "IMAStreamRequest.h" - -NS_ASSUME_NONNULL_BEGIN - -@class IMAAdDisplayContainer; -@protocol IMAVideoDisplay; - -/** - * Data object describing a stream request for a Google video stitcher video on demand serving - * stream. - */ -@interface IMAVideoStitcherVODStreamRequest : IMAStreamRequest - -/** The adTagURL for the stream. */ -@property(nonatomic, readonly) NSString *adTagURL; - -/** The URL of the content source for the stream. */ -@property(nonatomic, readonly) NSString *contentSourceURL; - -/** The networkCode associate with the stream. */ -@property(nonatomic, readonly) NSString *networkCode; - -/** The OAuth Token for the stream. */ -@property(nonatomic, readonly) NSString *OAuthToken; - -/** The project number for the stream. */ -@property(nonatomic, readonly) NSString *projectNumber; - -/** The region for the stream. */ -@property(nonatomic, readonly) NSString *region; - -/** - * The session options are used to set Video Stitcher-specific parameters - * for this request. - */ -@property(nonatomic, copy, nullable) NSDictionary *videoStitcherSessionOptions; - -/** - * Initializes a stream request instance with the given network code, content source url, ad tag - * url, project number, region, and OAuth token. Uses the given ad display container to display the - * stream. - * - * @param adTagURL The adTagURL for the stream. - * @param contentSourceURL The contentSourceURL for the stream. - * @param networkCode The networkCode for the stream. - * @param OAuthToken The OAuth token for the stream. - * @param projectNumber The projectNumber for the stream. - * @param region The region for the stream. - * @param adDisplayContainer The IMAAdDisplayContainer for rendering the ad UI. - * @param videoDisplay The IMAVideoDisplay where the stream will be played. - * @param userContext The user context for tracking requests (optional) - * - * @return The IMAVideoStitcherVODStreamRequest instance. - */ -- (instancetype)initWithAdTagURL:(NSString *)adTagURL - region:(NSString *)region - projectNumber:(NSString *)projectNumber - OAuthToken:(NSString *)OAuthToken - networkCode:(NSString *)networkCode - contentSourceURL:(NSString *)contentSourceURL - adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer - videoDisplay:(id)videoDisplay - userContext:(nullable id)userContext - videoStitcherSessionOptions: - (nullable NSDictionary *)videoStitcherSessionOptions; -/** - * Initializes a stream request instance with the given network code, content source url, ad tag - * url, project number, region, and OAuth token. Uses the given ad display container to display the - * stream. Uses the picture in picture proxy to track PIP events. - * - * @param adTagURL The adTagURL code for the stream. - * @param contentSourceURL The contentSourceURL code for the stream. - * @param networkCode The networkCode for the stream. - * @param OAuthToken The OAuth Token for the stream. - * @param projectNumber The projectNumber for the stream. - * @param region The region for the stream. - * @param adDisplayContainer The IMAAdDisplayContainer for rendering the ad UI. - * @param videoDisplay The IMAVideoDisplay where the stream will be played. - * @param pictureInPictureProxy The IMAPictureInPictureProxy for tracking PIP events. - * @param userContext The user context for tracking requests (optional) - * - * @return The IMAVideoStitcherVODStreamRequest instance. - */ -- (instancetype)initWithAdTagURL:(NSString *)adTagURL - region:(NSString *)region - projectNumber:(NSString *)projectNumber - OAuthToken:(NSString *)OAuthToken - networkCode:(NSString *)networkCode - contentSourceURL:(NSString *)contentSourceURL - adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer - videoDisplay:(id)videoDisplay - pictureInPictureProxy:(nullable IMAPictureInPictureProxy *)pictureInPictureProxy - userContext:(nullable id)userContext - videoStitcherSessionOptions: - (nullable NSDictionary *)videoStitcherSessionOptions; - -/** - * :nodoc: - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/RNGoogleIMA.xcodeproj/project.pbxproj b/ios/RNGoogleIMA.xcodeproj/project.pbxproj index 746a237..9a55623 100644 --- a/ios/RNGoogleIMA.xcodeproj/project.pbxproj +++ b/ios/RNGoogleIMA.xcodeproj/project.pbxproj @@ -26,40 +26,6 @@ /* Begin PBXFileReference section */ 134814201AA4EA6300B7C361 /* libRNGoogleIMA.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNGoogleIMA.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 33E51A2E2BF3BEA2006CD259 /* IMAVideoDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAVideoDisplay.h; sourceTree = ""; }; - 33E51A2F2BF3BEA2006CD259 /* IMASettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMASettings.h; sourceTree = ""; }; - 33E51A302BF3BEA2006CD259 /* IMALiveStreamRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMALiveStreamRequest.h; sourceTree = ""; }; - 33E51A312BF3BEA2006CD259 /* IMASecureSignals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMASecureSignals.h; sourceTree = ""; }; - 33E51A322BF3BEA2006CD259 /* IMAContentPlayhead.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAContentPlayhead.h; sourceTree = ""; }; - 33E51A332BF3BEA2006CD259 /* IMAPodVODStreamRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAPodVODStreamRequest.h; sourceTree = ""; }; - 33E51A342BF3BEA2006CD259 /* IMAAdPlaybackInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdPlaybackInfo.h; sourceTree = ""; }; - 33E51A352BF3BEA2006CD259 /* IMAAdDisplayContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdDisplayContainer.h; sourceTree = ""; }; - 33E51A362BF3BEA3006CD259 /* IMAAVPlayerContentPlayhead.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAVPlayerContentPlayhead.h; sourceTree = ""; }; - 33E51A372BF3BEA3006CD259 /* IMACuepoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMACuepoint.h; sourceTree = ""; }; - 33E51A382BF3BEA3006CD259 /* IMAAVPlayerVideoDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAVPlayerVideoDisplay.h; sourceTree = ""; }; - 33E51A392BF3BEA3006CD259 /* IMASecureSignalsAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMASecureSignalsAdapter.h; sourceTree = ""; }; - 33E51A3A2BF3BEA3006CD259 /* IMAAdsRenderingSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdsRenderingSettings.h; sourceTree = ""; }; - 33E51A3B2BF3BEA3006CD259 /* IMAAd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAd.h; sourceTree = ""; }; - 33E51A3C2BF3BEA3006CD259 /* IMAStreamManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAStreamManager.h; sourceTree = ""; }; - 33E51A3D2BF3BEA3006CD259 /* IMAUiElements.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAUiElements.h; sourceTree = ""; }; - 33E51A3E2BF3BEA3006CD259 /* IMAAdError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdError.h; sourceTree = ""; }; - 33E51A3F2BF3BEA3006CD259 /* IMAStreamRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAStreamRequest.h; sourceTree = ""; }; - 33E51A402BF3BEA3006CD259 /* IMAFriendlyObstruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAFriendlyObstruction.h; sourceTree = ""; }; - 33E51A412BF3BEA3006CD259 /* IMAVODStreamRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAVODStreamRequest.h; sourceTree = ""; }; - 33E51A422BF3BEA3006CD259 /* IMAAdEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdEvent.h; sourceTree = ""; }; - 33E51A432BF3BEA3006CD259 /* IMAVideoStitcherLiveStreamRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAVideoStitcherLiveStreamRequest.h; sourceTree = ""; }; - 33E51A442BF3BEA3006CD259 /* IMACompanionAdSlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMACompanionAdSlot.h; sourceTree = ""; }; - 33E51A452BF3BEA3006CD259 /* IMAAdsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdsManager.h; sourceTree = ""; }; - 33E51A462BF3BEA3006CD259 /* IMAAdsRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdsRequest.h; sourceTree = ""; }; - 33E51A472BF3BEA3006CD259 /* IMAPictureInPictureProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAPictureInPictureProxy.h; sourceTree = ""; }; - 33E51A482BF3BEA3006CD259 /* IMAPodStreamRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAPodStreamRequest.h; sourceTree = ""; }; - 33E51A492BF3BEA3006CD259 /* IMACompanionAd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMACompanionAd.h; sourceTree = ""; }; - 33E51A4A2BF3BEA3006CD259 /* IMAAdPodInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdPodInfo.h; sourceTree = ""; }; - 33E51A4B2BF3BEA3006CD259 /* IMAVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAVersion.h; sourceTree = ""; }; - 33E51A4C2BF3BEA3006CD259 /* IMAAdsLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAAdsLoader.h; sourceTree = ""; }; - 33E51A4D2BF3BEA3006CD259 /* IMAVideoStitcherVODStreamRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAVideoStitcherVODStreamRequest.h; sourceTree = ""; }; - 33E51A4E2BF3BEA3006CD259 /* GoogleInteractiveMediaAds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GoogleInteractiveMediaAds.h; sourceTree = ""; }; - 33E51A4F2BF3BEA3006CD259 /* IMAUniversalAdID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IMAUniversalAdID.h; sourceTree = ""; }; B14A91712321DC2A00F252FC /* RNGoogleIMAConverters.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNGoogleIMAConverters.m; sourceTree = ""; }; B14E759D2320093400E87672 /* RNGoogleIMA.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNGoogleIMA.m; sourceTree = ""; }; B14E759E2320093400E87672 /* RNGoogleIMA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNGoogleIMA.h; sourceTree = ""; }; @@ -89,40 +55,6 @@ 58B511D21A9E6C8500147676 = { isa = PBXGroup; children = ( - 33E51A4E2BF3BEA3006CD259 /* GoogleInteractiveMediaAds.h */, - 33E51A3B2BF3BEA3006CD259 /* IMAAd.h */, - 33E51A352BF3BEA2006CD259 /* IMAAdDisplayContainer.h */, - 33E51A3E2BF3BEA3006CD259 /* IMAAdError.h */, - 33E51A422BF3BEA3006CD259 /* IMAAdEvent.h */, - 33E51A342BF3BEA2006CD259 /* IMAAdPlaybackInfo.h */, - 33E51A4A2BF3BEA3006CD259 /* IMAAdPodInfo.h */, - 33E51A4C2BF3BEA3006CD259 /* IMAAdsLoader.h */, - 33E51A452BF3BEA3006CD259 /* IMAAdsManager.h */, - 33E51A3A2BF3BEA3006CD259 /* IMAAdsRenderingSettings.h */, - 33E51A462BF3BEA3006CD259 /* IMAAdsRequest.h */, - 33E51A362BF3BEA3006CD259 /* IMAAVPlayerContentPlayhead.h */, - 33E51A382BF3BEA3006CD259 /* IMAAVPlayerVideoDisplay.h */, - 33E51A492BF3BEA3006CD259 /* IMACompanionAd.h */, - 33E51A442BF3BEA3006CD259 /* IMACompanionAdSlot.h */, - 33E51A322BF3BEA2006CD259 /* IMAContentPlayhead.h */, - 33E51A372BF3BEA3006CD259 /* IMACuepoint.h */, - 33E51A402BF3BEA3006CD259 /* IMAFriendlyObstruction.h */, - 33E51A302BF3BEA2006CD259 /* IMALiveStreamRequest.h */, - 33E51A472BF3BEA3006CD259 /* IMAPictureInPictureProxy.h */, - 33E51A482BF3BEA3006CD259 /* IMAPodStreamRequest.h */, - 33E51A332BF3BEA2006CD259 /* IMAPodVODStreamRequest.h */, - 33E51A312BF3BEA2006CD259 /* IMASecureSignals.h */, - 33E51A392BF3BEA3006CD259 /* IMASecureSignalsAdapter.h */, - 33E51A2F2BF3BEA2006CD259 /* IMASettings.h */, - 33E51A3C2BF3BEA3006CD259 /* IMAStreamManager.h */, - 33E51A3F2BF3BEA3006CD259 /* IMAStreamRequest.h */, - 33E51A3D2BF3BEA3006CD259 /* IMAUiElements.h */, - 33E51A4F2BF3BEA3006CD259 /* IMAUniversalAdID.h */, - 33E51A4B2BF3BEA3006CD259 /* IMAVersion.h */, - 33E51A2E2BF3BEA2006CD259 /* IMAVideoDisplay.h */, - 33E51A432BF3BEA3006CD259 /* IMAVideoStitcherLiveStreamRequest.h */, - 33E51A4D2BF3BEA3006CD259 /* IMAVideoStitcherVODStreamRequest.h */, - 33E51A412BF3BEA3006CD259 /* IMAVODStreamRequest.h */, B14A91712321DC2A00F252FC /* RNGoogleIMAConverters.m */, B14E75DF23202AE000E87672 /* RNGoogleIMAManager.h */, B14E75E023202AE000E87672 /* RNGoogleIMAManager.m */, From 12b4116648eb98806a205ac13bf86ec9c9ef1e16 Mon Sep 17 00:00:00 2001 From: Nikolas Vasconcelos Date: Tue, 14 May 2024 15:42:09 -0300 Subject: [PATCH 6/7] WEB-2703: fix ios build [wip] --- ios/RNGoogleIMA.m | 22 +++++++++++++++------- package.json | 4 ++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/ios/RNGoogleIMA.m b/ios/RNGoogleIMA.m index b8a1159..db4c997 100644 --- a/ios/RNGoogleIMA.m +++ b/ios/RNGoogleIMA.m @@ -1,8 +1,6 @@ #import "RNGoogleIMA.h" #import "RNGoogleIMAConverters.m" #import "UIView+React.h" -#import "IMAAdDisplayContainer.h" -#import "IMAAVPlayerVideoDisplay.h" static NSString *const statusKeyPath = @"status"; static NSString *const rctVideoNativeID = @"RNGoogleIMAPlayer"; @@ -150,8 +148,15 @@ -(void) configure:(RCTVideo *) rctVideo if (rctVideo) { _rctVideo = rctVideo; _rctVideo.rctVideoDelegate = self; - // Create an ad display container for ad rendering. - _adDisplayContainer = [[IMAAdDisplayContainer alloc] initWithAdContainer:_adContainerView companionSlots:nil]; + if (self.companionView) { + _adDisplayContainer = [[IMAAdDisplayContainer alloc] initWithAdContainer:_adContainerView + viewController:self + companionSlots:@[ self.companionSlot ]]; + } else { + _adDisplayContainer = [[IMAAdDisplayContainer alloc] initWithAdContainer:_adContainerView + viewController:self + companionSlots:nil]; + } } } @@ -200,7 +205,7 @@ -(BOOL) shouldSetupPlayerItem:(AVPlayerItem *) playerItem forSource:(NSDictionar // if (!_contentPlayer) { [self invalidatePlayer]; - _contentPlayer = [AVPlayer playerWithPlayerItem:nil]; + _contentPlayer = [AVPlayer playerWithPlayerItem:_fallbackPlayerItem]; [_contentPlayer pause]; [_contentPlayer setRate:0]; @@ -240,14 +245,17 @@ - (void)requestStreamForSource:(NSDictionary *)source { IMAStreamRequest *request; if (_assetKey != nil) { // Live stream request. + request = [[IMALiveStreamRequest alloc] ]; request = [[IMALiveStreamRequest alloc] initWithAssetKey:_assetKey adDisplayContainer:_adDisplayContainer - videoDisplay:_avPlayerVideoDisplay]; + videoDisplay:_avPlayerVideoDisplay + userContext:nil]; } else { request = [[IMAVODStreamRequest alloc] initWithContentSourceID:_contentSourceID videoID:_videoID adDisplayContainer:_adDisplayContainer - videoDisplay:_avPlayerVideoDisplay]; + videoDisplay:_avPlayerVideoDisplay + userContext:nil]; } [request setAdTagParameters:_adTagParameters]; diff --git a/package.json b/package.json index 3b7672f..39055b6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-native-google-ima", "title": "React Native Google IMA", - "version": "0.4.2", + "version": "0.5.1", "description": "Google IMA for React Native", "summary": "TODO", "main": "index.js", @@ -26,7 +26,7 @@ "peerDependencies": { "prop-types": "^15", "deprecated-react-native-prop-types": "^2.3.0", - "react-native-video": "https://github.com/tedconf/react-native-video.git#RCTVideoDelegate" + "react-native-video": "git+ssh://git@github.com:tedconf/react-native-video.git#RCTVideoDelegate-5.2.0-22Sep13_01_IOS14Fix_RN_0-70" }, "devDependencies": {}, "dependencies": {} From 883251b319c40db4cbb22f146274875613cf389e Mon Sep 17 00:00:00 2001 From: Nikolas Vasconcelos Date: Tue, 14 May 2024 16:07:39 -0300 Subject: [PATCH 7/7] WEB-2703: fix ios build --- ios/RNGoogleIMA.m | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ios/RNGoogleIMA.m b/ios/RNGoogleIMA.m index db4c997..1e63205 100644 --- a/ios/RNGoogleIMA.m +++ b/ios/RNGoogleIMA.m @@ -148,10 +148,10 @@ -(void) configure:(RCTVideo *) rctVideo if (rctVideo) { _rctVideo = rctVideo; _rctVideo.rctVideoDelegate = self; - if (self.companionView) { + if (_adContainerView) { _adDisplayContainer = [[IMAAdDisplayContainer alloc] initWithAdContainer:_adContainerView viewController:self - companionSlots:@[ self.companionSlot ]]; + companionSlots:nil]; } else { _adDisplayContainer = [[IMAAdDisplayContainer alloc] initWithAdContainer:_adContainerView viewController:self @@ -176,9 +176,7 @@ - (void)invalidatePlayer _streamManager = nil; } if (_avPlayerVideoDisplay != nil) { - if (_avPlayerVideoDisplay.player != nil) { - [_avPlayerVideoDisplay.player pause]; - } + [_avPlayerVideoDisplay pause]; _avPlayerVideoDisplay = nil; } if (_adsManager != nil) { @@ -245,7 +243,6 @@ - (void)requestStreamForSource:(NSDictionary *)source { IMAStreamRequest *request; if (_assetKey != nil) { // Live stream request. - request = [[IMALiveStreamRequest alloc] ]; request = [[IMALiveStreamRequest alloc] initWithAssetKey:_assetKey adDisplayContainer:_adDisplayContainer videoDisplay:_avPlayerVideoDisplay @@ -388,8 +385,8 @@ - (void)streamManager:(IMAStreamManager *)streamManager didReceiveAdEvent:(IMAAd [_contentPlayer pause]; [_avPlayerVideoDisplay pause]; - AVPlayer* player = _avPlayerVideoDisplay.player; - AVPlayerItem* playerItem = _avPlayerVideoDisplay.playerItem; + AVPlayer* player = _contentPlayer; + AVPlayerItem* playerItem = _fallbackPlayerItem; [_rctVideo setupPlayerItem:playerItem forSource:_source withPlayer:player]; [_rctVideo observeValueForKeyPath:statusKeyPath ofObject:playerItem change:nil context:nil]; break;