Package com.jwplayer.pub.api.background
Class MediaSessionHelper
java.lang.Object
com.jwplayer.pub.api.background.MediaSessionHelper
- All Implemented Interfaces:
EventListener
,AdvertisingEvents.OnAdCompleteListener
,AdvertisingEvents.OnAdErrorListener
,AdvertisingEvents.OnAdPlayListener
,AdvertisingEvents.OnAdSkippedListener
,VideoPlayerEvents.OnBufferListener
,VideoPlayerEvents.OnErrorListener
,VideoPlayerEvents.OnPauseListener
,VideoPlayerEvents.OnPlaylistCompleteListener
,VideoPlayerEvents.OnPlayListener
,VideoPlayerEvents.OnPlaylistItemListener
public class MediaSessionHelper
extends Object
implements VideoPlayerEvents.OnPlayListener, VideoPlayerEvents.OnPauseListener, VideoPlayerEvents.OnBufferListener, VideoPlayerEvents.OnErrorListener, VideoPlayerEvents.OnPlaylistItemListener, VideoPlayerEvents.OnPlaylistCompleteListener, AdvertisingEvents.OnAdPlayListener, AdvertisingEvents.OnAdErrorListener, AdvertisingEvents.OnAdSkippedListener, AdvertisingEvents.OnAdCompleteListener
-
Constructor Summary
ConstructorsModifierConstructorDescriptionMediaSessionHelper
(Context context, NotificationHelper notificationHelper, ServiceMediaApi serviceMediaApi) protected
MediaSessionHelper
(Context context, NotificationHelper notificationHelper, ServiceMediaApi serviceMediaApi, BGAFactory bgaFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
onAdComplete
(AdCompleteEvent adCompleteEvent) Fired whenever an ad has completed playback.void
onAdError
(AdErrorEvent adErrorEvent) Fired whenever an error prevents the ad from playing.void
onAdPlay
(AdPlayEvent adPlayEvent) Fired whenever an ad starts playing or when an ad is unpaused.void
onAdSkipped
(AdSkippedEvent adSkippedEvent) Fired whenever an ad has been skipped.void
onBuffer
(BufferEvent bufferEvent) Fired when the player enters the BUFFERING state.void
onError
(ErrorEvent errorEvent) Fired when a media error has occurred, causing the player to stop playback and go into IDLE mode.void
onPause
(PauseEvent pauseEvent) Fired when the player enters the PAUSED state.void
Fired when the player enters the PLAYING state.void
onPlaylistComplete
(PlaylistCompleteEvent playlistCompleteEvent) Fired when the player is done playing all items in the playlist.void
onPlaylistItem
(PlaylistItemEvent playlistItemEvent) Fired when the playlist index changes to a new playlist item.protected void
updateMediaSessionWith
(JWPlayer player)
-
Constructor Details
-
MediaSessionHelper
public MediaSessionHelper(Context context, NotificationHelper notificationHelper, ServiceMediaApi serviceMediaApi) -
MediaSessionHelper
protected MediaSessionHelper(Context context, NotificationHelper notificationHelper, ServiceMediaApi serviceMediaApi, BGAFactory bgaFactory)
-
-
Method Details
-
updateMediaSessionWith
-
onPlaylistItem
Description copied from interface:VideoPlayerEvents.OnPlaylistItemListener
Fired when the playlist index changes to a new playlist item. This event occurs before the player begins playing the new playlist item.- Specified by:
onPlaylistItem
in interfaceVideoPlayerEvents.OnPlaylistItemListener
- Parameters:
playlistItemEvent
- The payload that accompanies the onPlaylistItem() event.
-
onError
Description copied from interface:VideoPlayerEvents.OnErrorListener
Fired when a media error has occurred, causing the player to stop playback and go into IDLE mode.- Specified by:
onError
in interfaceVideoPlayerEvents.OnErrorListener
- Parameters:
errorEvent
- The payload that accompanies the onError() event.
-
onAdComplete
Description copied from interface:AdvertisingEvents.OnAdCompleteListener
Fired whenever an ad has completed playback.Supported for VAST and IMA.
- Specified by:
onAdComplete
in interfaceAdvertisingEvents.OnAdCompleteListener
- Parameters:
adCompleteEvent
- The payload that accompanies the onAdComplete() event.
-
onAdSkipped
Description copied from interface:AdvertisingEvents.OnAdSkippedListener
Fired whenever an ad has been skipped.Supported for VAST and IMA.
- Specified by:
onAdSkipped
in interfaceAdvertisingEvents.OnAdSkippedListener
- Parameters:
adSkippedEvent
- The payload that accompanies the onAdSkipped() event.
-
onAdPlay
Description copied from interface:AdvertisingEvents.OnAdPlayListener
Fired whenever an ad starts playing or when an ad is unpaused.- Specified by:
onAdPlay
in interfaceAdvertisingEvents.OnAdPlayListener
- Parameters:
adPlayEvent
- The payload that accompanies the onAdPlay() event.
-
onAdError
Description copied from interface:AdvertisingEvents.OnAdErrorListener
Fired whenever an error prevents the ad from playing.Supported for VAST and IMA.
- Specified by:
onAdError
in interfaceAdvertisingEvents.OnAdErrorListener
- Parameters:
adErrorEvent
- The payload that accompanies the onAdError() event.
-
onBuffer
Description copied from interface:VideoPlayerEvents.OnBufferListener
Fired when the player enters the BUFFERING state.- Specified by:
onBuffer
in interfaceVideoPlayerEvents.OnBufferListener
- Parameters:
bufferEvent
- The payload that accompanies the onBuffer() event.
-
onPause
Description copied from interface:VideoPlayerEvents.OnPauseListener
Fired when the player enters the PAUSED state.- Specified by:
onPause
in interfaceVideoPlayerEvents.OnPauseListener
- Parameters:
pauseEvent
- The payload that accompanies the onPause() event.
-
onPlay
Description copied from interface:VideoPlayerEvents.OnPlayListener
Fired when the player enters the PLAYING state.- Specified by:
onPlay
in interfaceVideoPlayerEvents.OnPlayListener
- Parameters:
playEvent
- The payload that accompanies the onPlay() event.
-
onPlaylistComplete
Description copied from interface:VideoPlayerEvents.OnPlaylistCompleteListener
Fired when the player is done playing all items in the playlist. However, if the repeat option is set true, this is never fired.- Specified by:
onPlaylistComplete
in interfaceVideoPlayerEvents.OnPlaylistCompleteListener
- Parameters:
playlistCompleteEvent
- The payload that accompanies the onPlaylistComplete() event.
-