Class MediaEvents
java.lang.Object
com.iab.omid.library.adsession.media.MediaEvents
This provides a complete list of native media events supported by OM SDK.
Using this event API assumes the native-layer audio/video 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 exception.
Created by Natasha Garner on 10/09/2017.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
adUserInteraction
(InteractionType interactionType) Notify all media listeners that the user has performed an ad interaction.void
Notify all media listeners that buffering has finished and media playback has resumed.void
Notify all media listeners that media playback has stopped and started buffering.void
complete()
Notify all media listeners that media playback is complete.static MediaEvents
createMediaEvents
(AdSession adSession) Create media events instance for the associated ad session.void
Notify all media listeners that media playback has reached the first quartile.void
midpoint()
Notify all media listeners that media playback has reached the midpoint.void
pause()
Notify all media listeners that media playback has paused after a user interaction.void
playerStateChange
(PlayerState playerState) Notify all media listeners that media player state has changed.void
resume()
Notify all media listeners that media playback has resumed (after being paused) after a user interaction.void
skipped()
Notify all media listeners that media playback has stopped as a user skip interaction.void
start
(float duration, float mediaPlayerVolume) Notify all media listeners that media content has started playing.void
Notify all media listeners that media playback has reached the third quartile.void
volumeChange
(float mediaPlayerVolume) Notify all media listeners that the media player volume has changed.
-
Method Details
-
createMediaEvents
Create 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.- Parameters:
adSession
- associated with the ad events.- Returns:
- new media events instance.
- Throws:
IllegalArgumentException
- if the supplied ad session is null.IllegalStateException
- if a media events instance has already been registered with the ad session.IllegalStateException
- if a media events instance has been created after the ad session has started.- See Also:
-
start
public void start(float duration, float mediaPlayerVolume) Notify all media listeners that media content has started playing.- Parameters:
duration
- of the selected media media (in seconds).mediaPlayerVolume
- from the native media player with a range between 0 and 1.- Throws:
IllegalArgumentException
- if an invalid duration or mediaPlayerVolume has been supplied.IllegalStateException
- if the ad session has not been started or has finished.
-
firstQuartile
public void firstQuartile()Notify all media listeners that media playback has reached the first quartile.- Throws:
IllegalStateException
- if the ad session has not been started or has finished.
-
midpoint
public void midpoint()Notify all media listeners that media playback has reached the midpoint.- Throws:
IllegalStateException
- if the ad session has not been started or has finished.
-
thirdQuartile
public void thirdQuartile()Notify all media listeners that media playback has reached the third quartile.- Throws:
IllegalStateException
- if the ad session has not been started or has finished.
-
complete
public void complete()Notify all media listeners that media playback is complete.- Throws:
IllegalStateException
- if the ad session has not been started or has finished.
-
pause
public void pause()Notify all media listeners that media playback has paused after a user interaction.- Throws:
IllegalStateException
- if the ad session has not been started or has finished.
-
resume
public void resume()Notify all media listeners that media playback has resumed (after being paused) after a user interaction.- Throws:
IllegalStateException
- if the ad session has not been started or has finished.
-
bufferStart
public void bufferStart()Notify all media listeners that media playback has stopped and started buffering.- Throws:
IllegalStateException
- if the ad session has not been started or has finished.
-
bufferFinish
public void bufferFinish()Notify all media listeners that buffering has finished and media playback has resumed.- Throws:
IllegalStateException
- if the ad session has not been started or has finished.
-
skipped
public void skipped()Notify all media listeners that media playback has stopped as a user skip interaction. Once skipped media it should not be possible for the media to resume playing content.- Throws:
IllegalStateException
- if the ad session has not been started or has finished.
-
volumeChange
public void volumeChange(float mediaPlayerVolume) Notify all media listeners that the media player volume has changed.- Parameters:
mediaPlayerVolume
- from the native media player with a range between 0 and 1.- Throws:
IllegalArgumentException
- if an invalid mediaPlayerVolume has been supplied.IllegalStateException
- if the ad session has not been started or has finished.
-
playerStateChange
Notify all media listeners that media player state has changed. SeePlayerState
for list of supported states.- Parameters:
playerState
- to signal the latest media player state- Throws:
IllegalArgumentException
- if the supplied player state is null.IllegalStateException
- if the ad session has not been started or has finished.- See Also:
-
adUserInteraction
Notify all media listeners that the user has performed an ad interaction. SeeInteractionType
for list of supported types.- Parameters:
interactionType
- to signal the latest user integration- Throws:
IllegalArgumentException
- if the supplied interaction type is null.IllegalStateException
- if the ad session has not been started or has finished.- See Also:
-