Class APSMediaPlayer
java.lang.Object
com.appscend.hub.KRHub
com.appscend.media.APSMediaPlayer
- All Implemented Interfaces:
APSMediaEventStateListener, APSMediaEventTimeoutListener, VolumeChangedInterface
public class APSMediaPlayer
extends KRHub
implements VolumeChangedInterface, APSMediaEventStateListener, APSMediaEventTimeoutListener
The APSMediaPlayer handles playback and rendering of APSMediaUnits and APSMediaOverlays.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringPosted when the video controls bar becomes visiblestatic final StringPosted when the video controls bar becomes hiddenstatic final StringPosted when the media player playback state has changed.static final StringPosted when the user taps on the media player surfacefinal android.os.HandlerThreadstatic final Stringstatic final Stringstatic final StringThe group name that overlay controllers must use when registering with the player.Fields inherited from class KRHub
kKRDefaultAdapterGroup -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOverlays(ArrayList<APSMediaOverlay> overlays) Enqueues a series of overlays to be triggered in the current media unit.voidRegisters an event listener for receiving player events.voidback()Proceeds to the previous unit in the playlist .voidRecalculate the rendering surface sizeintThe content duration in ms, never the IMA ad's.intThe content position in ms, never the IMA ad's.Generates an APSMediaOverlay object for displaying the built-in controls on screen, based on the settings of the unit.intReturns the current playback time.Returns a copy of the currently playing media unit.static voiddetachView(android.view.ViewGroup parent, android.view.View view) Removes an overlay view, clearing its Animation first: removed with one set (fillAfter keeps it), it stays in the parent's mDisappearingChildren.intduration()Returns the current unit's video clip total duration.voidemitEvent(ArrayList<String> urls, String event, APSMediaTrackingEvents.MediaEventType type, android.os.Bundle additionalInfo, APSMediaEvent sourceEvent) Sends an APSMediaTrackingEvent to all registered listenersvoidvoidMake the player exit full-screen modevoidfinish()Tears down all player resources, causing any currently playing units to stop and any tracking events to be issued.voidRequest the firing of the click tracking beacons in case a non-standard ad overlay is usedandroid.app.ActivityReturns a reference to the Activity the player was initialized with.longandroid.os.HandlerReturns a reference to a Handler for posting tasks to the UI thread.okhttp3.OkHttpClientThe Veeplay SDK uses OkHttp for sending tracking requests back to the VAST enabled ad-servers.static APSMediaPlayerReturns the singletonAPSMediaPlayerinstance, creating it if necessary.intintandroid.widget.RelativeLayoutgetSize()android.location.LocationDeprecated.YouTube units are skipped.booleanhasImaSuccessor(APSImaAdBreak imaAdBreak) Whether a finishing midroll has a queued IMA break due at the held content time to hand its paused content to.voidvoidhideHud()Hides the player "loading" activity indicator.booleanimaBreakFinished(APSImaAdBreak imaAdBreak, APSImaAdBreak.ContentHold hold) Main thread: frees a finished break's IMA slot, or hands it with the paused content to a queued same-time break; true if handed over.voidinit(android.app.Activity activity, boolean statusBarVisible) Initialize the Veeplay SDK.voidinsertMediaUnits(ArrayList<APSMediaUnit> mediaUnits) Inserts new media units after the current one, in the current playlist.static APSMediaPlayerThe live player, or null before the first getInstance() and after finish(); never creates one.booleanbooleanbooleanbooleanReturns a boolean value specifing if the player is currently in fullscreen (read-only).booleanCheck if Google Cast support is enabledstatic booleanChecks if the player was already previously initializedbooleanbooleanisPaused()booleanReturns a Boolean value specifing if the player is currently playing a playlist of units (read-only).booleanbooleanbooleanCheck if the Google IMA SDK is enabled (replacing Veeplay VAST parser)booleanbooleanReturns a Boolean value specifing if the player is currently rendering a playlist of units (read-only).booleanbooleanCheck if the surface view is secured from capturebooleanMethod for checking if the player is currently doing a seek operationstatic booleanbooleanisStreamingUrl(String url) Method for determining if an URL represents a stream or notbooleanChecks if the Veeplay container is currently on-screen and un-obscured by any other viewsintThe duration in ms of the last content unit whose duration was known, kept after it finished.voidOnce the active renderer has started playback, this method handles the triggering of the correct tracking events, as well as starting the internal state timer.voidPosts a message to LogCatstatic voidlog_message(String message) booleanvoidnext()Proceeds to the next unit in the playlist and sends an exit event.voidUsed by renderers to notify that they have completed a seek operation.voidSignals that the bound activity has entered the "paused" statevoidSignals that the bound activity has entered the "resumed" statevoidonEventStateChanged(APSMediaEvent event, APSMediaEvent.APSMediaEventState newEventState) A listener for the current state of the events in the current unit.voidonEventTimeout(APSMediaEvent event) A handler for APSMediaEvents that timeout during their preloadingbooleanInstructs the player that a new URL needs to be interpreted and executed.voidSignals to the player that the orientation of the device is changingvoidpause()Pauses playback of the current unit.voidCall this method in the onActivityResult callback of the activity linked to the player.voidplay()Starts playback of the current unit.intplayableDuration(int duration) Returns the current unit's video clip playable duration (the time interval that has already buffered and is ready for playback).voidReturns the current unit's playback state.voidplaybackStateChanged(APSMediaPlayer.MPMoviePlaybackState newState, boolean track) voidplaybackStateChanged(APSMediaPlayer.MPMoviePlaybackState newState, boolean track, android.os.Bundle additionalInfo) Method for transitioning the player between various playback states (paused / playing / seeking, for example)player()All Veeplay renderers (MediaPlayer, ExoPlayer, GoogleCast or any custom renderer) implement the common interface IVeeplayRenderervoidSignals to that the player view was tapped (for example for hiding the on-screen controls)A copy of the playlist taken under its lock.voidplayMediaUnits(ArrayList<APSMediaEvent> mediaUnits) Sets and begins playback of an array of media units.voidWith a currently running content unit, start playback of another streamvoidRemoves all currently registered listeners.voidremoveMediaUnits(List<APSMediaEvent> units) Removes a list of media units from the playlistvoidRemoves a registered event listener.voidReplaces the currently playing APSMediaUnit with a collection of media units.voidRepositions all currently displayed overlaysvoidRestarts playbackvoidseekTo(int pos) Sets the current playback time.voidsetActionDelegate(APSMediaPlayerActionDelegate actionDelegate) voidsetAdvancedViewabilityTracking(boolean isEnabled) Enable more advanced viewability tracking that takes the entire hierarchy into accountvoidsetAdvertisingIdentifier(String advertisingIdentifier) voidsetAdvertisingIdentifierType(String advertisingIdentifierType) voidsetAllowConditionalAds(boolean allowConditionalAds) voidsetAutoPauseWhenNotVisible(boolean isEnabled) Automatically pause playback if the player container is not viewablevoidsetCurrentImaAdBreak(APSImaAdBreak currentImaAdBreak) voidsetCurrentlyInFullscreenOverlayActivity(boolean currentlyInFullscreenOverlayActivity) voidsetFullscreenOrientationBehaviour(APSMediaPlayer.FullscreenOrientationBehaviour fullscreenOrientationBehaviour) voidEnable Google Cast (needs the veeplay-player-android-cast artifact) and its Media Route Button in all content units.voidsetHttpErrorsListener(HTTPErrorsListener httpErrorsListener) voidsetInlineModeParent(android.view.ViewGroup parent) voidsetLeaveFullscreenOnStop(boolean leaveFullscreenOnStop) voidsetMediaUnits(ArrayList<APSMediaEvent> mediaUnits) Sets new units to the playlist, clearing any old ones.voidsetMute(boolean toMute) Mutes or unmutes audio playback.voidsetPlayableDuration(int duration) Method for setting the currently buffered durationvoidsetPlayExternalOverlaysFullscreen(boolean fullscreenMode) voidsetPreferExoPlayer2(boolean preferExoPlayer2) Deprecated.Both ExoPlayer renderers were replaced by the Media3 renderer; this only raises its priority.voidsetPreferGoogleIma(boolean preferGoogleIma) Enable or disable Google IMA VAST parser support.voidsetPreferMediaPlayerRenderer(boolean preferMediaPlayer) voidsetRegulationInformation(RegulationInformation regulationInformation) voidsetRestrictRootedAccess(boolean restrictRootedAccess) voidsetSecureSurfaceView(boolean is_secure) Method for preventing the player SurfaceView from being captured in a screenshot or on unsecure screens.static voidsetSessionCookiesEnabled(boolean enabled) Turns the session cookie jar for configuration, VAST, tracking and SSAI requests on (the default) or off.voidsetSize(int width, int height) Sets the size of the main player container.voidsetUserAgent(String newUserAgent) voidsetUserLocation(android.location.Location userLocation) voidsetVolume(float volume) Set the current playback audio volume.voidsetYouTubeApiKey(String apiKey) Deprecated.YouTube units are skipped.booleanChecks if currentUnit is not nullvoidvoidshowHud()Shows the player "loading" activity indicator.voidskip()Proceeds to the next unit in the playlist and sends a skip event.voidstep()Silently proceeds to the next unit in the playlist.voidstop()Stops playback of the current unit.voidMethod for switching the current renderer to the next highest priority rendererer.voidtakeImaSlot(APSMediaEvent event) A pre- or postroll takes the IMA slot when it triggers; playlist breaks are already sequential.voidToggle the current fullscreen status.voidtrackforEvent(ArrayList<String> urls, String event, APSMediaTrackingEvents.MediaEventType type, APSMediaEvent sourceEvent) voidtrackforEvent(ArrayList<String> urls, String event, APSMediaTrackingEvents.MediaEventType type, APSMediaEvent sourceEvent, boolean emitEvent) voidtrackforEvent(ArrayList<String> urls, String event, APSMediaTrackingEvents.MediaEventType type, APSMediaEvent sourceEvent, boolean emitEvent, android.os.Bundle additionalInfo) Sends tracking information to one or more servers.voidHandles the tear-down of the currently playing unit when it finishes (either because of unit completion, or because an error has occured or the unit is being skipped).voiduserPinched(float scale) Handle a pinch action on the player view, toggling full screen mode on.android.view.ViewGroupThe containerViewof the player.voidvolumeChanged(int volume) Detects changes in the current system audio volume and triggers any relevant VAST events.Methods inherited from class KRHub
adapterForType, adapterForTypeInGroup, adaptersForGroup, registerAdapter, registerAdapterInGroup, registerClass, registerClassInGroupModifier and TypeMethodDescriptionadapterForType(String type) Returns an object of the specified type, if such an object is currently registered in the default group.adapterForTypeInGroup(String type, String group) Returns an object of the specified type, if such an object is currently registered in the specified group.adaptersForGroup(String group) Returns the list of available registered objects for a specified group.voidregisterAdapter(Object adapter) Registers a new adapter to the default group.voidregisterAdapterInGroup(Object adapter, String group) Registers a new adapter to a specific groupvoidregisterClass(Class<?> _class, String type) Registers a class to the default group, under a specific type.voidregisterClassInGroup(Class<?> _class, String group, String type) Registers a class to a specific group and a specific type.
-
Field Details
-
kAPSMediaPlayerOverlayControllersGroup
The group name that overlay controllers must use when registering with the player.- See Also:
-
kAPSMediaPlayerFrameworkExtensionsGroup
- See Also:
-
kAPSMediaPlayerDRMPluginsGroup
- See Also:
-
APSMoviePlayerWasTappedNotification
Posted when the user taps on the media player surface- See Also:
-
APSMoviePlayerControlsDisplayedNotification
Posted when the video controls bar becomes visible- See Also:
-
APSMoviePlayerControlsHiddenNotification
Posted when the video controls bar becomes hidden- See Also:
-
APSMoviePlayerStatusChangedNotification
Posted when the media player playback state has changed. You can immediately get the new state using theplaybackStatemethod of the APSMediaPlayer instance.- See Also:
-
_currentUnit
-
handlerThread
public final android.os.HandlerThread handlerThread
-
-
Method Details
-
isProcessing
public boolean isProcessing()Returns a Boolean value specifing if the player is currently rendering a playlist of units (read-only). -
getInstance
Returns the singletonAPSMediaPlayerinstance, creating it if necessary.- Returns:
- The shared
APSMediaPlayerinstance
-
instanceIfInitialized
The live player, or null before the first getInstance() and after finish(); never creates one. -
getActivity
public android.app.Activity getActivity()Returns a reference to the Activity the player was initialized with.- Returns:
- a reference to the Activity the player was initialized with.
-
getHandler
public android.os.Handler getHandler()Returns a reference to a Handler for posting tasks to the UI thread.- Returns:
- a Handler reference
-
controlsOverlay
Generates an APSMediaOverlay object for displaying the built-in controls on screen, based on the settings of the unit.- Returns:
- a fully configured controls APSMediaOverlay object.
-
userPinched
public void userPinched(float scale) Handle a pinch action on the player view, toggling full screen mode on.- Parameters:
scale- the scale at which the pinch gesture was performed
-
isFullscreen
public boolean isFullscreen()Returns a boolean value specifing if the player is currently in fullscreen (read-only). -
toggleFullscreen
public void toggleFullscreen()Toggle the current fullscreen status. -
enterFullscreen
public void enterFullscreen() -
setInlineModeParent
public void setInlineModeParent(android.view.ViewGroup parent) -
exitFullscreen
public void exitFullscreen()Make the player exit full-screen mode -
init
public void init(android.app.Activity activity, boolean statusBarVisible) Initialize the Veeplay SDK. This should be done as early as possible in the Activity lifecycle. Init should be always called when starting the application or if finish() was previously called and the player should be reused.- Parameters:
activity- the Activity the player is bound tostatusBarVisible- whether the height of the OS status bar should be taken into account when layouting
-
detachView
public static void detachView(android.view.ViewGroup parent, android.view.View view) Removes an overlay view, clearing its Animation first: removed with one set (fillAfter keeps it), it stays in the parent's mDisappearingChildren. -
playerTapped
public void playerTapped()Signals to that the player view was tapped (for example for hiding the on-screen controls) -
showControls
public void showControls() -
hideControls
public void hideControls() -
playlistSnapshot
A copy of the playlist taken under its lock. -
log_message
-
log
Posts a message to LogCat- Parameters:
message- The message to be posted
-
trackforEvent
public void trackforEvent(ArrayList<String> urls, String event, APSMediaTrackingEvents.MediaEventType type, APSMediaEvent sourceEvent) -
trackforEvent
public void trackforEvent(ArrayList<String> urls, String event, APSMediaTrackingEvents.MediaEventType type, APSMediaEvent sourceEvent, boolean emitEvent) -
trackforEvent
public void trackforEvent(ArrayList<String> urls, String event, APSMediaTrackingEvents.MediaEventType type, APSMediaEvent sourceEvent, boolean emitEvent, android.os.Bundle additionalInfo) Sends tracking information to one or more servers. All specified URLs will be requested via GET. SeeAPSMediaTrackingEventsAPSMediaTrackingEventsfor a list of supported event types.- Parameters:
urls- An array ofStringobjects that should be pinged.event- A descriptive text of the events.type- The tracked event type. See APSMediaTrackingEvents.sourceEvent- The APSMediaUnit or APSMediaOverlay that triggered this event
-
getCurrentPlayingUrl
- Returns:
- The URL currently being played by the player
-
shouldAutoplay
public boolean shouldAutoplay()Checks if currentUnit is not null- Returns:
- _currentUnit.shouldAutoplay if currentUnit in not null, else returns true
-
currentUnit
Returns a copy of the currently playing media unit.- Returns:
- An
APSMediaUnitobject representing the current unit.
-
openURL
Instructs the player that a new URL needs to be interpreted and executed. This method will first ask the actionDelegate to respond to the given URL. If the actionDelegate declines to respond and the URL has a web scheme such as ('http:// or 'https://') then an in-app web browser window will be displayed modally.- Parameters:
url- The URL that needs to be loaded.
-
performPostTapAction
public void performPostTapAction()Call this method in the onActivityResult callback of the activity linked to the player. The resultCode received when returning from the Veeso Web Browser is always 999 -
playMediaUnits
Sets and begins playback of an array of media units.- Parameters:
mediaUnits- An array ofAPSMediaUnitobjects.
-
playAlreadySetMediaUnits
public void playAlreadySetMediaUnits() -
setSize
public void setSize(int width, int height) Sets the size of the main player container.- Parameters:
width- in pixelsheight- in pixels
-
getSize
-
viewController
public android.view.ViewGroup viewController()The containerViewof the player. -
player
All Veeplay renderers (MediaPlayer, ExoPlayer, GoogleCast or any custom renderer) implement the common interface IVeeplayRenderer- Returns:
- a reference to the currently active renderer
-
playbackStateChanged
-
playbackStateChanged
public void playbackStateChanged(APSMediaPlayer.MPMoviePlaybackState newState, boolean track, android.os.Bundle additionalInfo) Method for transitioning the player between various playback states (paused / playing / seeking, for example)- Parameters:
newState- the new playback state the player is transitioning intotrack- whether to send tracking requests to relevant ad-servers or not.
-
playbackState
Returns the current unit's playback state.- Returns:
- The current playback state.
-
pause
public void pause()Pauses playback of the current unit. -
resumePlay
public void resumePlay()Restarts playback -
isPaused
public boolean isPaused()- Returns:
- true if the playback is currently paused, false otherwise
-
play
Starts playback of the current unit. -
stop
public void stop()Stops playback of the current unit. -
currentPlaybackTime
public int currentPlaybackTime()Returns the current playback time.- Returns:
- The current playback time.
-
contentPlaybackTime
public int contentPlaybackTime()The content position in ms, never the IMA ad's. -
playableDuration
public int playableDuration(int duration) Returns the current unit's video clip playable duration (the time interval that has already buffered and is ready for playback).- Parameters:
duration- - if the current video is shown through an overlay, this parameter will be multiplied by the result of the playableDuration method invoked on the overlay controller. Can be 0 in other cases;- Returns:
- The video playable duration.
-
seekTo
public void seekTo(int pos) Sets the current playback time.- Parameters:
pos- The playback time to be set in ms.
-
duration
public int duration()Returns the current unit's video clip total duration.- Returns:
- The video total duration.
-
contentDuration
public int contentDuration()The content duration in ms, never the IMA ad's. -
isPlaying
public boolean isPlaying()Returns a Boolean value specifing if the player is currently playing a playlist of units (read-only). -
movieSourceTypeIsLiveStream
public boolean movieSourceTypeIsLiveStream() -
skip
public void skip()Proceeds to the next unit in the playlist and sends a skip event. -
back
public void back()Proceeds to the previous unit in the playlist . -
loadStatePlayable
public void loadStatePlayable()Once the active renderer has started playback, this method handles the triggering of the correct tracking events, as well as starting the internal state timer. -
unitFinished
Handles the tear-down of the currently playing unit when it finishes (either because of unit completion, or because an error has occured or the unit is being skipped). Progress to the next unit is triggered automatically.- Parameters:
reason- the reason the unit is being teared down
-
lastContentDuration
public int lastContentDuration()The duration in ms of the last content unit whose duration was known, kept after it finished. -
volumeChanged
public void volumeChanged(int volume) Detects changes in the current system audio volume and triggers any relevant VAST events.- Specified by:
volumeChangedin interfaceVolumeChangedInterface- Parameters:
volume- the current audio volume value
-
finish
public void finish()Tears down all player resources, causing any currently playing units to stop and any tracking events to be issued. Once finish is called, the player should be re-initialized before further use. -
takeImaSlot
A pre- or postroll takes the IMA slot when it triggers; playlist breaks are already sequential. -
hasImaSuccessor
Whether a finishing midroll has a queued IMA break due at the held content time to hand its paused content to. -
imaBreakFinished
Main thread: frees a finished break's IMA slot, or hands it with the paused content to a queued same-time break; true if handed over. -
imaBreakScheduler
-
next
public void next()Proceeds to the next unit in the playlist and sends an exit event. -
step
public void step()Silently proceeds to the next unit in the playlist. Used in cases such as midroll adbreaks triggering. -
resetDisplayedOverlays
public void resetDisplayedOverlays()Repositions all currently displayed overlays -
orientationWillChange
public void orientationWillChange()Signals to the player that the orientation of the device is changing -
showHud
public void showHud()Shows the player "loading" activity indicator. -
hideHud
public void hideHud()Hides the player "loading" activity indicator. -
isStreamingUrl
Method for determining if an URL represents a stream or not- Parameters:
url- the url to be used for determination
-
setYouTubeApiKey
Deprecated.YouTube units are skipped.No longer used: YouTube units are not supported.- Parameters:
apiKey- ignored
-
getYoutubeApiKey
Deprecated.YouTube units are skipped.- Returns:
- The value passed to
setYouTubeApiKey(String)
-
addTrackingEventListener
Registers an event listener for receiving player events.- Parameters:
listener- - An instance of a class implementing theAPSMediaPlayerTrackingEventListenerinterface
-
removeTrackingEventListener
Removes a registered event listener.- Parameters:
listener- - An instance of a class implementing theAPSMediaPlayerTrackingEventListenerinterface
-
removeAllTrackingEventListeners
public void removeAllTrackingEventListeners()Removes all currently registered listeners. -
getOverlayContainer
public android.widget.RelativeLayout getOverlayContainer()- Returns:
- a reference to the RelativeLayout containing the overlays
-
emitEvent
public void emitEvent(ArrayList<String> urls, String event, APSMediaTrackingEvents.MediaEventType type, android.os.Bundle additionalInfo, APSMediaEvent sourceEvent) Sends an APSMediaTrackingEvent to all registered listeners- Parameters:
urls- any associated tracking URLsevent- the VAST string name of the eventtype- the APSMediaTrackingEvent.MediaEventType value for the event to notifyadditionalInfo- a collection of additional information to relay (for example the current playback time for a progress event)
-
onEventStateChanged
public void onEventStateChanged(APSMediaEvent event, APSMediaEvent.APSMediaEventState newEventState) A listener for the current state of the events in the current unit. Detects preloaded events and queues their triggering.- Specified by:
onEventStateChangedin interfaceAPSMediaEventStateListener- Parameters:
event- the event that has changed statenewEventState- the state the event has transitioned to
-
onEventTimeout
A handler for APSMediaEvents that timeout during their preloading- Specified by:
onEventTimeoutin interfaceAPSMediaEventTimeoutListener- Parameters:
event- the event that has encountered the timeout
-
replaceCurrentUnitWithUnits
Replaces the currently playing APSMediaUnit with a collection of media units. Useful for unpacking the ad breaks inside of a MediaUnit into a series of playable APSMediaUnits.- Parameters:
units- an ArrayList of units to replace the current unit with.
-
insertMediaUnits
Inserts new media units after the current one, in the current playlist.- Parameters:
mediaUnits- An array ofAPSMediaUnitobjects to be inserted into the playlist after the current unit.
-
setMediaUnits
Sets new units to the playlist, clearing any old ones.- Parameters:
mediaUnits- An array ofAPSMediaUnitobjects to create a new playlist.
-
addOverlays
Enqueues a series of overlays to be triggered in the current media unit.- Parameters:
overlays- the overlays to be inserted into the queue
-
setSecureSurfaceView
public void setSecureSurfaceView(boolean is_secure) Method for preventing the player SurfaceView from being captured in a screenshot or on unsecure screens. Defaults to true. This method should be called before calling init()- Parameters:
is_secure- use true in order to secure the SurfaceView
-
isSecureSurfaceView
public boolean isSecureSurfaceView()Check if the surface view is secured from capture- Returns:
- true if the surface view is running in protected mode
-
setPlayableDuration
public void setPlayableDuration(int duration) Method for setting the currently buffered duration- Parameters:
duration- the currently playable duration
-
getMainViewWidth
public int getMainViewWidth()- Returns:
- the current width of the main view container
-
getMainViewHeight
public int getMainViewHeight()- Returns:
- the current height of the main view container
-
playVideo
With a currently running content unit, start playback of another stream- Parameters:
url- the stream URL
-
computeSurfaceSize
public void computeSurfaceSize()Recalculate the rendering surface size -
onActivityPaused
public void onActivityPaused()Signals that the bound activity has entered the "paused" state -
onActivityResumed
public void onActivityResumed()Signals that the bound activity has entered the "resumed" state -
isActivityPaused
public boolean isActivityPaused()- Returns:
- true between
onActivityPaused()andonActivityResumed()
-
switchRenderer
public void switchRenderer()Method for switching the current renderer to the next highest priority rendererer. Useful if, for example, a Google Cast device was just connected. -
setGoogleCastEnabled
public void setGoogleCastEnabled()Enable Google Cast (needs the veeplay-player-android-cast artifact) and its Media Route Button in all content units. Cast starts now if the player is initialized, otherwise in init(). -
isGoogleCastEnabled
public boolean isGoogleCastEnabled()Check if Google Cast support is enabled -
getPlaylist
- Returns:
- a list of the currently queued media units
-
removeMediaUnits
Removes a list of media units from the playlist- Parameters:
units- the list of units to be removed
-
notifySeekFinished
public void notifySeekFinished()Used by renderers to notify that they have completed a seek operation. -
isSeeking
public boolean isSeeking()Method for checking if the player is currently doing a seek operation- Returns:
- true if the player is currently seeking
-
getHttpClient
public okhttp3.OkHttpClient getHttpClient()The Veeplay SDK uses OkHttp for sending tracking requests back to the VAST enabled ad-servers.- Returns:
- The OkHttp client instance used for tracking requests
-
isInitialized
public static boolean isInitialized()Checks if the player was already previously initialized- Returns:
- true if the player is initialized
-
setSessionCookiesEnabled
public static void setSessionCookiesEnabled(boolean enabled) Turns the session cookie jar for configuration, VAST, tracking and SSAI requests on (the default) or off. While off, those requests neither store nor send cookies, as in 3.1.26. Call it beforeinit(Activity, boolean).- Parameters:
enabled- - false to send no cookies on those requests
-
isSessionCookiesEnabled
public static boolean isSessionCookiesEnabled()- Returns:
- true while ad and tracking requests use the session cookie jar
-
setMute
public void setMute(boolean toMute) Mutes or unmutes audio playback.- Parameters:
toMute- - true for muting audio, false for unmute
-
setVolume
public void setVolume(float volume) Set the current playback audio volume.- Parameters:
volume- - a float between 0f and 1f
-
setFullscreenOrientationBehaviour
public void setFullscreenOrientationBehaviour(APSMediaPlayer.FullscreenOrientationBehaviour fullscreenOrientationBehaviour) -
isViewable
public boolean isViewable()Checks if the Veeplay container is currently on-screen and un-obscured by any other views- Returns:
- true or false
-
getCachedPlaybackTime
public long getCachedPlaybackTime() -
isCurrentlyInFullscreenOverlayActivity
public boolean isCurrentlyInFullscreenOverlayActivity() -
setCurrentlyInFullscreenOverlayActivity
public void setCurrentlyInFullscreenOverlayActivity(boolean currentlyInFullscreenOverlayActivity) -
setUserAgent
-
getUserAgent
-
getActionDelegate
-
setActionDelegate
-
isPreferMediaPlayerRenderer
public boolean isPreferMediaPlayerRenderer() -
setPreferMediaPlayerRenderer
public void setPreferMediaPlayerRenderer(boolean preferMediaPlayer) -
isRestrictRootedAccess
public boolean isRestrictRootedAccess() -
setRestrictRootedAccess
public void setRestrictRootedAccess(boolean restrictRootedAccess) -
isPreferExoPlayer2
public boolean isPreferExoPlayer2() -
setPreferExoPlayer2
Deprecated.Both ExoPlayer renderers were replaced by the Media3 renderer; this only raises its priority. -
getUserLocation
public android.location.Location getUserLocation() -
setUserLocation
public void setUserLocation(android.location.Location userLocation) -
getAdvertisingIdentifier
-
setAdvertisingIdentifier
-
getAdvertisingIdentifierType
-
setAdvertisingIdentifierType
-
getRegulationInformation
-
setRegulationInformation
-
getPackageName
-
isAllowConditionalAds
public boolean isAllowConditionalAds() -
setAllowConditionalAds
public void setAllowConditionalAds(boolean allowConditionalAds) -
getHttpErrorsListener
-
setHttpErrorsListener
-
isLeaveFullscreenOnStop
public boolean isLeaveFullscreenOnStop() -
setLeaveFullscreenOnStop
public void setLeaveFullscreenOnStop(boolean leaveFullscreenOnStop) -
setPlayExternalOverlaysFullscreen
public void setPlayExternalOverlaysFullscreen(boolean fullscreenMode) -
isPreferGoogleIma
public boolean isPreferGoogleIma()Check if the Google IMA SDK is enabled (replacing Veeplay VAST parser)- Returns:
- true if Google IMA is selected
-
setPreferGoogleIma
public void setPreferGoogleIma(boolean preferGoogleIma) Enable or disable Google IMA VAST parser support. Make sure this is called before triggering desired AdBreaks (preferably during the player configuration step).- Parameters:
preferGoogleIma- true if Google IMA should be used, false for Veeplay VAST parser
-
fireClickTrackingBeacons
public void fireClickTrackingBeacons()Request the firing of the click tracking beacons in case a non-standard ad overlay is used -
setAdvancedViewabilityTracking
public void setAdvancedViewabilityTracking(boolean isEnabled) Enable more advanced viewability tracking that takes the entire hierarchy into account- Parameters:
isEnabled- - true if the advanced mode should be enabled, false otherwise
-
setAutoPauseWhenNotVisible
public void setAutoPauseWhenNotVisible(boolean isEnabled) Automatically pause playback if the player container is not viewable- Parameters:
isEnabled- - true if auto-pause should be enabled, false otherwise
-
isPlayingImaAd
public boolean isPlayingImaAd() -
getCurrentImaAdBreak
-
setCurrentImaAdBreak
-