OMIDMediaEvents
Objective-C
@interface OMIDMediaEvents : NSObject
Swift
class OMIDMediaEvents : NSObject
This provides a complete list of native media events supported by OMID. Using this event API assumes the media player is fully responsible for communicating all media events at the appropriate times. Only one media events implementation can be associated with the ad session and any attempt to create multiple instances will result in an error.
-
Initializes media events instance for the associated ad session. Any attempt to create a media events instance will fail if the supplied ad session has already started.
See
OMIDAdSessionDeclaration
Objective-C
- (nullable instancetype)initWithAdSession:(nonnull OMIDAdSession *)session error:(NSError *_Nullable *_Nullable)error;
Swift
init(adSession session: OMIDAdSession) throws
Parameters
session
The ad session associated with the ad events.
Return Value
A new media events instance. Returns nil if the supplied ad session is nil or if a media events instance has already been registered with the ad session or if a media events instance has been created after the ad session has started.
-
Notifies all media listeners that media content has started playing.
Declaration
Objective-C
- (void)startWithDuration:(CGFloat)duration mediaPlayerVolume:(CGFloat)mediaPlayerVolume;
Swift
func start(withDuration duration: CGFloat, mediaPlayerVolume: CGFloat)
Parameters
duration
The duration of the selected media (in seconds).
mediaPlayerVolume
The volume from the native media player with a range between 0 and 1.
-
Notifies all media listeners that media playback has reached the first quartile.
Declaration
Objective-C
- (void)firstQuartile;
Swift
func firstQuartile()
-
Notifies all media listeners that media playback has reached the midpoint.
Declaration
Objective-C
- (void)midpoint;
Swift
func midpoint()
-
Notifies all media listeners that media playback has reached the third quartile.
Declaration
Objective-C
- (void)thirdQuartile;
Swift
func thirdQuartile()
-
Notifies all media listeners that media playback is complete.
Declaration
Objective-C
- (void)complete;
Swift
func complete()
-
Notifies all media listeners that media playback has paused after a user interaction.
Declaration
Objective-C
- (void)pause;
Swift
func pause()
-
Notifies all media listeners that media playback has resumed after being paused.
Declaration
Objective-C
- (void)resume;
Swift
func resume()
-
Notifies all media listeners that media playback has stopped as a user skip interaction. Once skipped, it should not be possible for the media to resume playing content.
Declaration
Objective-C
- (void)skipped;
Swift
func skipped()
-
Notifies all media listeners that media playback has stopped and started buffering.
Declaration
Objective-C
- (void)bufferStart;
Swift
func bufferStart()
-
Notifies all media listeners that buffering has finished and media playback has resumed.
Declaration
Objective-C
- (void)bufferFinish;
Swift
func bufferFinish()
-
Notifies all media listeners that the media player volume has changed.
Declaration
Objective-C
- (void)volumeChangeTo:(CGFloat)playerVolume;
Swift
func volumeChange(to playerVolume: CGFloat)
Parameters
playerVolume
The volume from the native media player with a range between 0 and 1.
-
Notifies all media listeners that media player state has changed. See
OMIDPlayerState
for list of supported states.See
OMIDPlayerStateDeclaration
Objective-C
- (void)playerStateChangeTo:(OMIDPlayerState)playerState;
Swift
func playerStateChange(to playerState: OMIDPlayerState)
Parameters
playerState
The latest media player state.
-
Notifies all media listeners that the user has performed an ad interaction. See
OMIDInteractionType
for a list of supported types.See
OMIDInteractionTypeDeclaration
Objective-C
- (void)adUserInteractionWithType:(OMIDInteractionType)interactionType;
Swift
func adUserInteraction(withType interactionType: OMIDInteractionType)
Parameters
interactionType
The latest user integration.