Package com.castlabs.sdk.vimond
Class VimondComponent
java.lang.Object
com.castlabs.analytics.AnalyticsSession
com.castlabs.sdk.vimond.VimondComponent
- All Implemented Interfaces:
IAnalyticsSession
,PlayerControllerPlugin.Component
,PlayerListener
,VimondCallback
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 via setToken(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
Modifier and TypeMethodDescriptionvoid
adStartInternal
(Ad ad) void
void
id()
void
onDestroy
(PlayerController playerController) void
onDisplayChanged
(DisplayInfo displayInfo, boolean canPlay) void
onDurationChanged
(long durationUs) void
onError
(CastlabsPlayerException error) void
onExoPlayerStateChangedInternal
(boolean playWhenReady, int playbackState) void
void
void
onOpenBundle
(PlayerController playerController, Bundle bundle) void
onOpenState
(PlayerController playerController, PlayerConfig playerConfig) void
onPlaybackPositionChanged
(long playbackPositionMs) void
void
void
onSeekRangeChanged
(long startTimeMs, long endTimeMs) void
onSeekTo
(long newPosition) void
onSpeedChanged
(float speed) void
void
onVideoKeyStatusChanged
(List<VideoTrackQuality> trackList) void
onVideoSizeChanged
(int width, int height, float pixelWidthHeightRatio) void
Will be called on each an every Vimond backend response, regardless of the status code.void
void
void
void
void
seekStartInternal
(long newPosition) void
sendErrorInternal
(String code, String message, int severity) void
setCallback
(VimondCallback callback) Set theVimondCallback
to invoke on each Vimond backend response.void
setRaiseErrorOnInvalidStatusCode
(boolean value) Whether to throw a fatal Exception if the Vimond backend answers with an invalid HTTP code (400, 401, 403).void
setRaiseErrorOnUnreachableHost
(boolean value) Whether to throw a fatal Exception if the Vimond backend is unreachable.void
Set a new token for authentication purposes.void
startInternal
(PlayerController playerController, AnalyticsMetaData analyticsMetaData) void
Methods inherited from class com.castlabs.analytics.AnalyticsSession
adClick, adError, adPause, adResume, adSkipped, adStart, adStop, adWillStart, detachFromController, getEnabled, onExoPlayerStateChanged, release, reportPlayerState, seekEnd, seekProcessed, seekStart, sendError, setEnabled, start, stop
-
Method Details
-
startInternal
public void startInternal(@NonNull PlayerController playerController, @NonNull AnalyticsMetaData analyticsMetaData) -
stopInternal
public void stopInternal() -
setCallback
Set theVimondCallback
to 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
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_ERROR
as 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_REACHED
as itstype
.- Parameters:
value
- the value
-
onVimondResponse
public void onVimondResponse(int httpStatusCode, @NonNull Map<String, List<String>> headers, @Nullable String responseBody) Description copied from interface:VimondCallback
Will be called on each an every Vimond backend response, regardless of the status code.- Specified by:
onVimondResponse
in 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.
-
adStartInternal
-
adStopInternal
public void adStopInternal() -
reportPlayerStateInternal
-
sendErrorInternal
-
seekStartInternal
public void seekStartInternal(long newPosition) -
seekEndInternal
public void seekEndInternal() -
seekProcessedInternal
public void seekProcessedInternal() -
detachFromControllerInternal
public void detachFromControllerInternal() -
releaseInternal
public void releaseInternal() -
onExoPlayerStateChangedInternal
public void onExoPlayerStateChangedInternal(boolean playWhenReady, int playbackState) -
id
- Specified by:
id
in interfacePlayerControllerPlugin.Component
-
onDestroy
- Specified by:
onDestroy
in interfacePlayerControllerPlugin.Component
-
onOpenBundle
- Specified by:
onOpenBundle
in interfacePlayerControllerPlugin.Component
-
onOpenState
- Specified by:
onOpenState
in interfacePlayerControllerPlugin.Component
-
onFatalErrorOccurred
- Specified by:
onFatalErrorOccurred
in interfacePlayerListener
-
onError
- Specified by:
onError
in interfacePlayerListener
-
onStateChanged
- Specified by:
onStateChanged
in interfacePlayerListener
-
onSeekTo
public void onSeekTo(long newPosition) - Specified by:
onSeekTo
in interfacePlayerListener
-
onSeekCompleted
public void onSeekCompleted()- Specified by:
onSeekCompleted
in interfacePlayerListener
-
onVideoSizeChanged
public void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio) - Specified by:
onVideoSizeChanged
in interfacePlayerListener
-
onSeekRangeChanged
public void onSeekRangeChanged(long startTimeMs, long endTimeMs) - Specified by:
onSeekRangeChanged
in interfacePlayerListener
-
onPlaybackPositionChanged
public void onPlaybackPositionChanged(long playbackPositionMs) - Specified by:
onPlaybackPositionChanged
in interfacePlayerListener
-
onDisplayChanged
- Specified by:
onDisplayChanged
in interfacePlayerListener
-
onDurationChanged
public void onDurationChanged(long durationUs) - Specified by:
onDurationChanged
in interfacePlayerListener
-
onSpeedChanged
public void onSpeedChanged(float speed) - Specified by:
onSpeedChanged
in interfacePlayerListener
-
onPlayerModelChanged
public void onPlayerModelChanged()- Specified by:
onPlayerModelChanged
in interfacePlayerListener
-
onVideoKeyStatusChanged
- Specified by:
onVideoKeyStatusChanged
in interfacePlayerListener
-
onFullyBuffered
public void onFullyBuffered()- Specified by:
onFullyBuffered
in interfacePlayerListener
-