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).
  • Method Details

    • id

      @NonNull public Class id()
      Specified by:
      id in interface PlayerControllerPlugin.Component
    • onDestroy

      public void onDestroy(@NonNull PlayerController playerController)
      Specified by:
      onDestroy in interface PlayerControllerPlugin.Component
    • onOpenBundle

      public void onOpenBundle(@NonNull PlayerController playerController, @NonNull Bundle bundle)
      Specified by:
      onOpenBundle in interface PlayerControllerPlugin.Component
    • onOpenState

      public void onOpenState(@NonNull PlayerController playerController, @NonNull PlayerConfig playerConfig)
      Specified by:
      onOpenState in interface PlayerControllerPlugin.Component
    • onComponentViewsChanged

      public void onComponentViewsChanged(@NonNull PlayerController playerController)
      Specified by:
      onComponentViewsChanged in interface PlayerControllerPlugin.ComponentViewListener
    • scanComponentViews

      @Nullable public Collection<Pair<Integer,View>> scanComponentViews(@NonNull ViewGroup container)
      Specified by:
      scanComponentViews in interface PlayerControllerPlugin.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

      @Nullable public Ad getCurrentAd()
      Returns the active advert in PRESTOplay's generic form.
      Returns:
      generic PRESTOplay ad object for the current advert, if any
    • getAdApi

      @NonNull public AdApi 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

      public void addSessionListener(@NonNull YospaceComponent.SessionListener listener)
      Adds a session lifecycle listener.
      Parameters:
      listener - listener to add
    • removeSessionListener

      public void removeSessionListener(@NonNull YospaceComponent.SessionListener listener)
      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, or null for 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

      public boolean canClickThrough(@Nullable String url)
      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 EXPANDED and COLLAPSED transitions; 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