Classes
The following classes are available globally.
-
Properties
See moreDeclaration
Objective-C
@interface OMIDAdEvents : NSObject /* * Initializes ad events instance associated with the supplied ad session. * * @param session The ad session associated with the ad events. * @return A new ad events instance associated with the supplied ad session. Returns nil if the supplied ad session is nil or if an ad events instance has already been registered with the ad session. */ - (nullable instancetype)initWithAdSession:(nonnull OMIDAdSession *)session error:(NSError * _Nullable * _Nullable)error; /* * Notifies the ad session that an impression event has occurred. * * When triggered all registered verification providers will be notified of this event. * * NOTE: the ad session will be automatically started if this method has been called first. */ - (BOOL)impressionOccurredWithError:(NSError *_Nullable *_Nullable)error; @end
Swift
class OMIDAdEvents : NSObject
-
Properties
See moreDeclaration
Objective-C
@interface OMIDAdSession : NSObject /* * The AdSession configuration is used for check owners. */ @property(nonatomic, readonly, nonnull) OMIDAdSessionConfiguration *configuration; /* * The native view which is used for viewability tracking. */ @property(nonatomic, weak, nullable) UIView *mainAdView; /* * Initializes new ad session supplying the context. * * Note that creating an OMIDAdSession sends a message to the OM SDK JS Service running in the * webview. If the OM SDK JS Service has not loaded before the ad session is created, the * message is lost, and the verification scripts will not receive any events. * * To prevent this, the implementation must wait until the webview finishes loading OM SDK * JavaScript before creating the OMIDAdSession. The easiest way is to create the OMIDAdSession * in a webview delegate callback (-[WKNavigationDelegate webView:didFinishNavigation:] or * -[UIWebViewDelegate webViewDidFinishLoad:]). Alternatively, if an implementation can receive an * HTML5 DOMContentLoaded event from the webview, it can create the OMIDAdSession in a message * handler for that event. * * @param context The context that provides the required information for initialising the ad session. * @return A new OMIDAdSession instance, or nil if the supplied context is nil. */ - (nullable instancetype)initWithConfiguration:(nonnull OMIDAdSessionConfiguration *)configuration adSessionContext:(nonnull OMIDAdSessionContext *)context error:(NSError *_Nullable *_Nullable)error; /* * Notifies all verification providers that the ad session has started and ad view tracking will begin. * * This method will have no affect if called after the ad session has finished. */ - (void)start; /* * Notifies all verification providers that the ad session has finished and all ad view tracking will stop. * * This method will have no affect if called after the ad session has finished. * * Note that ending an OMID ad session sends a message to the verification scripts running inside * the webview supplied by the integration. So that the verification scripts have enough time to * handle the 'sessionFinish' event, the integration must maintain a strong reference to the webview * for at least 1.0 seconds after ending the session. */ - (void)finish; /* * Adds friendly obstruction which should then be excluded from all ad session viewability calculations. * * This method will have no affect if called after the ad session has finished. * * @param friendlyObstruction The view to be excluded from all ad session viewability calculations. */ - (void)addFriendlyObstruction:(nonnull UIView *)friendlyObstruction; /* * Removes registered friendly obstruction. * * This method will have no affect if called after the ad session has finished. * * @param friendlyObstruction The view to be removed from the list of registered friendly obstructions. */ - (void)removeFriendlyObstruction:(nonnull UIView *)friendlyObstruction; /* * Utility method to remove all registered friendly obstructions. * * This method will have no affect if called after the ad session has finished. */ - (void)removeAllFriendlyObstructions; /* * Notifies the ad session that an error has occurred. * * When triggered all registered verification providers will be notified of this event. * * @param errorType The type of error. * @param message The message containing details of the error. */ - (void)logErrorWithType:(OMIDErrorType)errorType message:(nonnull NSString *)message NS_SWIFT_NAME(logError(withType:message:)); @end
Swift
class OMIDAdSession : NSObject
-
Properties
See moreDeclaration
Objective-C
@interface OMIDAdSessionConfiguration : NSObject @property OMIDOwner impressionOwner; @property OMIDOwner videoEventsOwner; @property BOOL isolateVerificationScripts; /* * Returns nil and sets error if OMID isn't active or arguments are invalid. * * @param impressionOwner providing details of who is responsible for triggering the impression event. * @param videoEventsOwner providing details of who is responsible for triggering video events. This is only required for video ad sessions and should be set to videoEventsOwner:OMIDNoneOwner for display ad sessions. * @param isolateVerificationScripts determines whether verification scripts will be placed in a sandboxed environment. This will not have any effect for native sessions. */ - (nullable instancetype)initWithImpressionOwner:(OMIDOwner)impressionOwner videoEventsOwner:(OMIDOwner)videoEventsOwner isolateVerificationScripts:(BOOL)isolateVerificationScripts error:(NSError *_Nullable *_Nullable)error; #pragma mark - Deprecated Methods - (nullable instancetype)initWithImpressionOwner:(OMIDOwner)impressionOwner videoEventsOwner:(OMIDOwner)videoEventsOwner error:(NSError *_Nullable *_Nullable)error __deprecated_msg("Use -initWithImpressionOwner:videoEventsOwner:isolateVerificationScripts:error: instead."); @end
Swift
class OMIDAdSessionConfiguration : NSObject
-
Properties
See moreDeclaration
Objective-C
@interface OMIDAdSessionContext : NSObject - (null_unspecified instancetype)init NS_UNAVAILABLE; /* * Initializes a new ad session context providing reference to partner and web view where OMID JS has been injected. * * Calling this method will set the ad session type to “html”. * <p> * NOTE: any attempt to create a new ad session will fail if OMID has not been activated (see {@link OMIDSDK} class for more information). * * @param partner Details of the integration partner responsible for the ad session. * @param webView The webView responsible for serving the ad content. Must be a UIWebView or WKWebView instance. The receiver holds a weak reference only. * @return A new HTML context instance. Returns nil if OMID has not been activated or if any of the parameters are nil. * @see OMIDSDK */ - (nullable instancetype)initWithPartner:(nonnull OMIDPartner *)partner webView:(nonnull UIView *)webView customReferenceIdentifier:(nullable NSString *)customReferenceIdentifier error:(NSError *_Nullable *_Nullable)error; /* * Initializes a new ad session context providing reference to partner and a list of script resources which should be managed by OMID. * * Calling this method will set the ad session type to “native”. * <p> * NOTE: any attempt to create a new ad session will fail if OMID has not been activated (see {@link OMIDSDK} class for more information). * * @param partner Details of the integration partner responsible for the ad session. * @param resources The array of all verification providers who expect to receive OMID event data. Must contain at least one verification script. The receiver creates a deep copy of the array. * @return A new native context instance. Returns nil if OMID has not been activated or if any of the parameters are invalid. * @see OMIDSDK */ - (nullable instancetype)initWithPartner:(nonnull OMIDPartner *)partner script:(nonnull NSString *)script resources:(nonnull NSArray<OMIDVerificationScriptResource *> *)resources customReferenceIdentifier:(nullable NSString *)customReferenceIdentifier error:(NSError *_Nullable *_Nullable)error; @end
Swift
class OMIDAdSessionContext : NSObject
-
Properties
See moreDeclaration
Objective-C
@interface OMIDPartner : NSObject @property(nonatomic, readonly, nonnull) NSString *name; @property(nonatomic, readonly, nonnull) NSString *versionString; /* * Initializes new partner instance providing both name and versionString. * * Both name and version are mandatory. * * @param name It is used to uniquely identify the integration partner. * @param versionString It is used to uniquely identify the integration partner. * @return A new partner instance, or nil if any of the parameters are either null or blank */ - (nullable instancetype)initWithName:(nonnull NSString *)name versionString:(nonnull NSString *)versionString; - (null_unspecified instancetype)init NS_UNAVAILABLE; @end
Swift
class OMIDPartner : NSObject
-
Properties
See moreDeclaration
Objective-C
@interface OMIDSDK : NSObject /* * The current semantic version of the integrated OMID library. */ + (nonnull NSString *)versionString; /* * Allows the integration partner to check that they are compatible with the running OMID library version. * * @param OMIDAPIVersion The version of OMID library integrated by the partner. * @return YES if the version supplied is compatible with the integrated OMID library version. * * Note: Planned to be deprecated in next major release */ + (BOOL)isCompatibleWithOMIDAPIVersion:(nonnull NSString *)OMIDAPIVersion NS_SWIFT_NAME(isCompatible(withOMIDAPIVersion:)); /* * Shared OMIDSDK instance. */ @property(class, readonly, nonnull) OMIDSDK *sharedInstance NS_SWIFT_NAME(shared); /* * A Boolean value indicating whether the OMID library has been activated. * * The value of this property is YES if the OMID library has already been activated. Allows the integration partner to check that they are compatible with the running OMID library version. */ @property(atomic, readonly, getter = isActive) BOOL active; /* * Enables the integration partner to activate OMID prior to calling any other API methods. * * @param OMIDAPIVersion The version of OMID library integrated by the partner. * @param error If an error occurs, contains an NSError object that describes the problem. * @return YES if activation was successful when checking the supplied version number for compatibility. * */ - (BOOL)activateWithOMIDAPIVersion:(nonnull NSString *)OMIDAPIVersion error:(NSError *_Nullable *_Nullable)error; @end
Swift
class OMIDSDK : NSObject
-
Properties
See moreDeclaration
Objective-C
@interface OMIDScriptInjector : NSObject /* Injects the downloaded OMID JS content into the served HTML. @param scriptContent containing the OMID JS service content to be injected into the hidden tracking web view. @param html of the tag content which should be modified to include the downloaded OMID JS content. @param error If an error occurs, contains an NSError object. @return modified HTML including OMID JS or nil if an error occurs. */ + (nullable NSString *)injectScriptContent:(nonnull NSString *)scriptContent intoHTML:(nonnull NSString *)html error:(NSError *_Nullable *_Nullable)error; @end
Swift
class OMIDScriptInjector : NSObject
-
Properties
See moreDeclaration
Objective-C
@interface OMIDVASTProperties : NSObject @property(nonatomic, readonly, getter = isSkippable) BOOL skippable; @property(nonatomic, readonly) CGFloat skipOffset; @property(nonatomic, readonly, getter = isAutoPlay) BOOL autoPlay; @property(nonatomic, readonly) OMIDPosition position; /* * This method enables the video player to create a new VAST properties instance for skippable video ad placement. * * @param skipOffset The number of seconds before the skip button is presented. * @param autoPlay Determines whether the video will auto-play content. * @param position The position of the video in relation to other content. * @return A new instance of VAST properties. */ - (nonnull instancetype)initWithSkipOffset:(CGFloat)skipOffset autoPlay:(BOOL)autoPlay position:(OMIDPosition)position; /* * This method enables the video player to create a new VAST properties instance for non-skippable video ad placement. * * @param autoPlay Determines whether the video will auto-play content. * @param position The position of the video in relation to other content. * @return A new instance of VAST properties. */ - (nonnull instancetype)initWithAutoPlay:(BOOL)autoPlay position:(OMIDPosition)position; - (null_unspecified instancetype)init NS_UNAVAILABLE; @end
Swift
class OMIDVASTProperties : NSObject
-
Properties
See moreDeclaration
Objective-C
@interface OMIDVerificationScriptResource : NSObject @property(nonatomic, readonly, nonnull) NSURL *URL; @property(nonatomic, readonly, nullable) NSString *vendorKey; @property(nonatomic, readonly, nullable) NSString *parameters; /* * Initializes new verification script resource instance which requires vendor specific verification parameters. * * When calling this method all arguments are mandatory. * * @param vendorKey It is used to uniquely identify the verification provider. * @param URL The URL to be injected into the OMID managed JavaScript execution environment. * @param parameters The parameters which the verification provider script is expecting for the ad session. * @return A new verification script resource instance, or nil if any of the parameters are either null or blank. */ - (nullable instancetype)initWithURL:(nonnull NSURL *)URL vendorKey:(nonnull NSString *)vendorKey parameters:(nonnull NSString *)parameters; /* * Initializes new verification script resource instance which does not require any vendor specific verification parameters. * * When calling this method all arguments are mandatory. * * @param URL The URL to be injected into the OMID managed JavaScript execution environment. * @return A new verification script resource instance, or nil if URL is nil or blank. */ - (nullable instancetype)initWithURL:(nonnull NSURL *)URL; - (null_unspecified instancetype)init NS_UNAVAILABLE; @end
Swift
class OMIDVerificationScriptResource : NSObject
-
Properties
See moreDeclaration
Objective-C
@interface OMIDVideoEvents : NSObject /* * Initializes video events instance for the associated ad session. * Any attempt to create a video events instance will fail if the supplied ad session has already started. * * @param session The ad session associated with the ad events. * @return A new video events instance. Returns nil if the supplied ad session is nil or if a video events instance has already been registered with the ad session or if a video events instance has been created after the ad session has started. * @see OMIDAdSession */ - (nullable instancetype)initWithAdSession:(nonnull OMIDAdSession *)session error:(NSError *_Nullable *_Nullable)error; /* * Notifies all video listeners that video content has been loaded and ready to start playing. * * @param vastProperties The parameters containing static information about the video placement. * @see OMIDVASTProperties */ - (void)loadedWithVastProperties:(nonnull OMIDVASTProperties *)vastProperties; /* * Notifies all video listeners that video content has started playing. * * @param duration The duration of the selected video media (in seconds). * @param videoPlayerVolume The volume from the native video player with a range between 0 and 1. */ - (void)startWithDuration:(CGFloat)duration videoPlayerVolume:(CGFloat)videoPlayerVolume; /* * Notifies all video listeners that video playback has reached the first quartile. */ - (void)firstQuartile; /* * Notifies all video listeners that video playback has reached the midpoint. */ - (void)midpoint; /* * Notifies all video listeners that video playback has reached the third quartile. */ - (void)thirdQuartile; /* * Notifies all video listeners that video playback is complete. */ - (void)complete; /* * Notifies all video listeners that video playback has paused after a user interaction. */ - (void)pause; /* * Notifies all video listeners that video playback has resumed (after being paused) after a user interaction. */ - (void)resume; /* * Notifies all video listeners that video playback has stopped as a user skip interaction. * Once skipped video it should not be possible for the video to resume playing content. */ - (void)skipped; /* * Notifies all video listeners that video playback has stopped and started buffering. */ - (void)bufferStart; /* * Notifies all video listeners that buffering has finished and video playback has resumed. */ - (void)bufferFinish; /* * Notifies all video listeners that the video player volume has changed. * * @param playerVolume The volume from the native video player with a range between 0 and 1. */ - (void)volumeChangeTo:(CGFloat)playerVolume; /* * Notifies all video listeners that video player state has changed. See {@link OMIDPlayerState} for list of supported states. * * @param playerState The latest video player state. * @see OMIDPlayerState */ - (void)playerStateChangeTo:(OMIDPlayerState)playerState; /* * Notifies all video listeners that the user has performed an ad interaction. See {@link OMIDInteractionType} fro list of supported types. * * @param interactionType The latest user integration. * @see OMIDInteractionType */ - (void)adUserInteractionWithType:(OMIDInteractionType)interactionType NS_SWIFT_NAME(adUserInteraction(withType:)); @end
Swift
class OMIDVideoEvents : NSObject