Package com.castlabs.sdk.yospace
Class YospaceComponent
java.lang.Object
com.castlabs.sdk.yospace.YospaceComponent
- All Implemented Interfaces:
PlayerControllerPlugin.Component,PlayerControllerPlugin.ComponentViewListener,PlayerControllerPlugin.VisualComponent
public final class YospaceComponent
extends Object
implements PlayerControllerPlugin.VisualComponent
Per-controller Yospace API, available through
PlayerController.getComponent(Class).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceReceives initialization results and runtime session failures. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnalyticObserver(com.yospace.admanagement.AnalyticEventObserver observer) Adds a native Yospace analytics observer.voidAdds a session lifecycle listener.booleancanChangeVolume(boolean mute) Returns whether the requested mute state is permitted.booleancanClickThrough(String url) Returns whether the current advert may be clicked through.booleancanPause()Checks whether the active policy permits pausing.booleancanResize(boolean fullscreen) Returns whether the requested fullscreen state is permitted.intcanSkip()Checks when the current advert may be skipped.booleancanStop()Checks whether the active policy permits stopping.getAdApi()Returns PRESTOplay's generic ad interaction API.Returns the active advert in PRESTOplay's generic form.com.yospace.admanagement.AdBreakReturns the active native ad break.com.yospace.admanagement.AdvertReturns the active native advert.longReturns content time instead of stitched-stream time for VOD bookmarks.longgetPositionForPlayback(long bookmarkPositionMs) Converts a VOD content-time bookmark back to its stitched playhead.com.yospace.admanagement.SessionReturns the initialized active session, if any.id()voidonComponentViewsChanged(PlayerController playerController) voidonDestroy(PlayerController playerController) voidonOpenBundle(PlayerController playerController, Bundle bundle) voidonOpenState(PlayerController playerController, PlayerConfig playerConfig) voidremoveAnalyticObserver(com.yospace.admanagement.AnalyticEventObserver observer) Removes a native Yospace analytics observer.voidRemoves a session lifecycle listener.scanComponentViews(ViewGroup container) voidsetPlaybackPolicyHandler(com.yospace.yospacefeatures.PlaybackPolicyHandler handler) Replaces the playback policy used by future and current sessions.voidsetViewSize(com.yospace.admanagement.PlaybackEventHandler.ViewSize viewSize) Manually reports the view state; this takes precedence over automatic detection.longwillSeekTo(long positionMs) Returns the policy-adjusted destination, in milliseconds.
-
Method Details
-
id
- Specified by:
idin interfacePlayerControllerPlugin.Component
-
onDestroy
- Specified by:
onDestroyin interfacePlayerControllerPlugin.Component
-
onOpenBundle
- Specified by:
onOpenBundlein interfacePlayerControllerPlugin.Component
-
onOpenState
public void onOpenState(@NonNull PlayerController playerController, @NonNull PlayerConfig playerConfig) - Specified by:
onOpenStatein interfacePlayerControllerPlugin.Component
-
onComponentViewsChanged
- Specified by:
onComponentViewsChangedin interfacePlayerControllerPlugin.ComponentViewListener
-
scanComponentViews
- Specified by:
scanComponentViewsin interfacePlayerControllerPlugin.ComponentViewListener
-
getSession
@Nullable public com.yospace.admanagement.Session getSession()Returns the initialized active session, if any.- Returns:
- initialized active session, if any
-
getCurrentAdBreak
@Nullable public com.yospace.admanagement.AdBreak getCurrentAdBreak()Returns the active native ad break.- Returns:
- current Yospace ad break, if any
-
getCurrentAdvert
@Nullable public com.yospace.admanagement.Advert getCurrentAdvert()Returns the active native advert.- Returns:
- current Yospace advert, if any
-
getCurrentAd
Returns the active advert in PRESTOplay's generic form.- Returns:
- generic PRESTOplay ad object for the current advert, if any
-
getAdApi
Returns PRESTOplay's generic ad interaction API.- Returns:
- generic ad interaction API
-
addAnalyticObserver
public void addAnalyticObserver(@NonNull com.yospace.admanagement.AnalyticEventObserver observer) Adds a native Yospace analytics observer.- Parameters:
observer- observer to add
-
removeAnalyticObserver
public void removeAnalyticObserver(@NonNull com.yospace.admanagement.AnalyticEventObserver observer) Removes a native Yospace analytics observer.- Parameters:
observer- observer to remove
-
addSessionListener
Adds a session lifecycle listener.- Parameters:
listener- listener to add
-
removeSessionListener
Removes a session lifecycle listener.- Parameters:
listener- listener to remove
-
setPlaybackPolicyHandler
public void setPlaybackPolicyHandler(@Nullable com.yospace.yospacefeatures.PlaybackPolicyHandler handler) Replaces the playback policy used by future and current sessions.- Parameters:
handler- replacement, ornullfor the built-in policy
-
canPause
public boolean canPause()Checks whether the active policy permits pausing.- Returns:
- whether pausing is permitted at the current playhead
-
canStop
public boolean canStop()Checks whether the active policy permits stopping.- Returns:
- whether stopping is permitted at the current playhead
-
canSkip
public int canSkip()Checks when the current advert may be skipped.- Returns:
- -1 when skip is unavailable, otherwise milliseconds until it is available
-
willSeekTo
public long willSeekTo(long positionMs) Returns the policy-adjusted destination, in milliseconds.- Parameters:
positionMs- requested destination in milliseconds- Returns:
- policy-adjusted destination in milliseconds
-
canChangeVolume
public boolean canChangeVolume(boolean mute) Returns whether the requested mute state is permitted.- Parameters:
mute- requested mute state- Returns:
- whether the change is permitted
-
canResize
public boolean canResize(boolean fullscreen) Returns whether the requested fullscreen state is permitted.- Parameters:
fullscreen- requested fullscreen state- Returns:
- whether the resize is permitted
-
canClickThrough
Returns whether the current advert may be clicked through.- Parameters:
url- clickthrough URL- Returns:
- whether clickthrough is permitted
-
setViewSize
public void setViewSize(@NonNull com.yospace.admanagement.PlaybackEventHandler.ViewSize viewSize) Manually reports the view state; this takes precedence over automatic detection.Yospace v4 signals tracking events only for the
EXPANDEDandCOLLAPSEDtransitions; the remaining view states are accepted but not reported.- Parameters:
viewSize- view state to report
-
getPositionForBookmark
public long getPositionForBookmark()Returns content time instead of stitched-stream time for VOD bookmarks.- Returns:
- current content-time position suitable for a bookmark
-
getPositionForPlayback
public long getPositionForPlayback(long bookmarkPositionMs) Converts a VOD content-time bookmark back to its stitched playhead.- Parameters:
bookmarkPositionMs- content-time bookmark in milliseconds- Returns:
- stitched playback position in milliseconds
-