Package com.castlabs.sdk.vimond
Class VimondComponent
- java.lang.Object
-
- com.castlabs.sdk.vimond.VimondComponent
-
- All Implemented Interfaces:
AnalyticsSession,PlayerControllerPlugin.Component,PlayerListener,VimondCallback
public class VimondComponent extends Object implements AnalyticsSession, VimondCallback, PlayerListener
Main Vimond Plugin interaction point.To get an instance of the component, use the
PlayerController.getComponent(Class).The component can be used to register a
VimondCallback. In addition, a new authentication token can be provided at runtime viasetToken(String).VimondComponent vimond = playerController.getComponent(VimondComponent.class); vimond.setRaiseErrorOnUnreachableHost(true); // Fail if host unreachable vimond.setRaiseErrorOnInvalidStatusCode(true); // Fail if bad http status code is received vimond.setCallback(new VimondCallback() {@Override public void onVimondResponse(int httpStatusCode,@Nullable Map<String, List<String>> headers,@Nullable String responseBody) { Log.d(TAG, "Vimond response (" + httpStatusCode + ") " + responseBody); } });- Since:
- 4.2.34
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadError(CastlabsPlayerException exception)voidadSkipped()voidadStart(Ad ad)voidadStop()voiddetachFromController()Classid()voidonDestroy(PlayerController playerController)voidonDisplayChanged(DisplayInfo displayInfo, boolean canPlay)voidonDurationChanged(long durationUs)voidonError(CastlabsPlayerException error)voidonExoPlayerStateChanged(boolean playWhenReady, int playbackState)voidonFatalErrorOccurred(CastlabsPlayerException error)voidonFullyBuffered()voidonOpenBundle(PlayerController playerController, Bundle bundle)voidonOpenState(PlayerController playerController, PlayerConfig playerConfig)voidonPlaybackPositionChanged(long playbackPositionMs)voidonPlayerModelChanged()voidonSeekCompleted()voidonSeekRangeChanged(long startTimeMs, long endTimeMs)voidonSeekTo(long newPosition)voidonSpeedChanged(float speed)voidonStateChanged(PlayerController.State state)voidonVideoKeyStatusChanged(List<VideoTrackQuality> trackList)voidonVideoSizeChanged(int width, int height, float pixelWidthHeightRatio)voidonVimondResponse(int httpStatusCode, Map<String,List<String>> headers, String responseBody)Will be called on each an every Vimond backend response, regardless of the status code.voidrelease()voidseekEnd()voidseekProcessed()voidseekStart(long newPosition)voidsendError(String code, String message, int severity)voidsetCallback(VimondCallback callback)Set theVimondCallbackto invoke on each Vimond backend response.voidsetRaiseErrorOnInvalidStatusCode(boolean value)Whether to throw a fatal Exception if the Vimond backend answers with an invalid HTTP code (400, 401, 403).voidsetRaiseErrorOnUnreachableHost(boolean value)Whether to throw a fatal Exception if the Vimond backend is unreachable.voidsetToken(String token)Set a new token for authentication purposes.voidstart(PlayerController playerController, AnalyticsMetaData analyticsMetaData)voidstop()
-
-
-
Method Detail
-
start
public void start(@NonNull PlayerController playerController, @NonNull AnalyticsMetaData analyticsMetaData)- Specified by:
startin interfaceAnalyticsSession
-
stop
public void stop()
- Specified by:
stopin interfaceAnalyticsSession
-
setCallback
public void setCallback(@Nullable VimondCallback callback)Set theVimondCallbackto invoke on each Vimond backend response. The callback will also be invoked even if the plugin decides to shutdown playback by raising an error.- Parameters:
callback- the callback to set
-
setToken
public void setToken(@NonNull String token)Set a new token for authentication purposes. All network requests to Vimond backend will use the provided token.- Parameters:
token- the token to use
-
setRaiseErrorOnUnreachableHost
public void setRaiseErrorOnUnreachableHost(boolean value)
Whether to throw a fatal Exception if the Vimond backend is unreachable. true by default. The Exception thrown will haveCastlabsPlayerException.TYPE_CSL_NETWORK_ERRORas itstype.- Parameters:
value- the value
-
setRaiseErrorOnInvalidStatusCode
public void setRaiseErrorOnInvalidStatusCode(boolean value)
Whether to throw a fatal Exception if the Vimond backend answers with an invalid HTTP code (400, 401, 403). true by default. The Exception thrown will haveCastlabsPlayerException.TYPE_CSL_LIMIT_REACHEDas itstype.- Parameters:
value- the value
-
onVimondResponse
public void onVimondResponse(int httpStatusCode, @NonNull Map<String,List<String>> headers, @Nullable String responseBody)Description copied from interface:VimondCallbackWill be called on each an every Vimond backend response, regardless of the status code.- Specified by:
onVimondResponsein interfaceVimondCallback- Parameters:
httpStatusCode- the HTTP status code Vimond backend responded with, or -1 if couldn't get a response.headers- response headers, if applicable.responseBody- response body, if applicable.
-
adStart
public void adStart(Ad ad)
- Specified by:
adStartin interfaceAnalyticsSession
-
adStop
public void adStop()
- Specified by:
adStopin interfaceAnalyticsSession
-
adError
public void adError(CastlabsPlayerException exception)
- Specified by:
adErrorin interfaceAnalyticsSession
-
adSkipped
public void adSkipped()
- Specified by:
adSkippedin interfaceAnalyticsSession
-
sendError
public void sendError(String code, String message, int severity)
- Specified by:
sendErrorin interfaceAnalyticsSession
-
seekStart
public void seekStart(long newPosition)
- Specified by:
seekStartin interfaceAnalyticsSession
-
seekEnd
public void seekEnd()
- Specified by:
seekEndin interfaceAnalyticsSession
-
seekProcessed
public void seekProcessed()
- Specified by:
seekProcessedin interfaceAnalyticsSession
-
detachFromController
public void detachFromController()
- Specified by:
detachFromControllerin interfaceAnalyticsSession
-
release
public void release()
- Specified by:
releasein interfaceAnalyticsSession
-
onExoPlayerStateChanged
public void onExoPlayerStateChanged(boolean playWhenReady, int playbackState)- Specified by:
onExoPlayerStateChangedin interfaceAnalyticsSession
-
id
@NonNull public Class id()
- Specified by:
idin interfacePlayerControllerPlugin.Component
-
onDestroy
public void onDestroy(@NonNull PlayerController playerController)- Specified by:
onDestroyin interfacePlayerControllerPlugin.Component
-
onOpenBundle
public void onOpenBundle(@NonNull PlayerController playerController, @NonNull Bundle bundle)- Specified by:
onOpenBundlein interfacePlayerControllerPlugin.Component
-
onOpenState
public void onOpenState(PlayerController playerController, PlayerConfig playerConfig)
- Specified by:
onOpenStatein interfacePlayerControllerPlugin.Component
-
onFatalErrorOccurred
public void onFatalErrorOccurred(@NonNull CastlabsPlayerException error)- Specified by:
onFatalErrorOccurredin interfacePlayerListener
-
onError
public void onError(@NonNull CastlabsPlayerException error)- Specified by:
onErrorin interfacePlayerListener
-
onStateChanged
public void onStateChanged(@NonNull PlayerController.State state)- Specified by:
onStateChangedin interfacePlayerListener
-
onSeekTo
public void onSeekTo(long newPosition)
- Specified by:
onSeekToin interfacePlayerListener
-
onSeekCompleted
public void onSeekCompleted()
- Specified by:
onSeekCompletedin interfacePlayerListener
-
onVideoSizeChanged
public void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio)- Specified by:
onVideoSizeChangedin interfacePlayerListener
-
onSeekRangeChanged
public void onSeekRangeChanged(long startTimeMs, long endTimeMs)- Specified by:
onSeekRangeChangedin interfacePlayerListener
-
onPlaybackPositionChanged
public void onPlaybackPositionChanged(long playbackPositionMs)
- Specified by:
onPlaybackPositionChangedin interfacePlayerListener
-
onDisplayChanged
public void onDisplayChanged(DisplayInfo displayInfo, boolean canPlay)
- Specified by:
onDisplayChangedin interfacePlayerListener
-
onDurationChanged
public void onDurationChanged(long durationUs)
- Specified by:
onDurationChangedin interfacePlayerListener
-
onSpeedChanged
public void onSpeedChanged(float speed)
- Specified by:
onSpeedChangedin interfacePlayerListener
-
onPlayerModelChanged
public void onPlayerModelChanged()
- Specified by:
onPlayerModelChangedin interfacePlayerListener
-
onVideoKeyStatusChanged
public void onVideoKeyStatusChanged(List<VideoTrackQuality> trackList)
- Specified by:
onVideoKeyStatusChangedin interfacePlayerListener
-
onFullyBuffered
public void onFullyBuffered()
- Specified by:
onFullyBufferedin interfacePlayerListener
-
-