General states
You can get various player states from the app by setting the PlayerStateDelegate
.
videoPlayer?.setPlayerStateDelegate(object : PlayerStateDelegate {
override fun onPlayerStateChanged(playerEvent: PlayerEvent<Any>) {
if (playerEvent.type == PlayerState.RELATED_PLAYED) {
videoPlayer?.changeVideo(playerEvent.value.toString())
}
}
})
PlayerState Types and Return Value
Player State: VIDEO_PAUSED
Description | Video is paused. |
Value Return Type | Boolean |
Player State: VIDEO_RESUMED
Description | Video is resumed. |
Value Return Type | Boolean |
Player State: VIDEO_TIME_UPDATE
Description | Notifies each second of the current video that is playing. |
Value Return Type | Pair - seconds[Float], totalSeconds[Float] |
Player State: VIDEO_ENDED
Description | Video has ended. |
Value Return Type | Boolean |
Player State: AUTO_PLAY
Description | Autoplay is enabled. |
Value Return Type | Boolean |
Player State: REPLAY
Description | Video is replayed. |
Value Return Type | Boolean |
Player State: REWIND
Description | User clicked the rewind button. |
Value Return Type | Int |
Player State: FORWARD
Description | User Clicked the forward button. |
Value Return Type | Int |
Player State: SEEKING
Description | The user is seeking with a slider. |
Value Return Type | Float |
Player State: MUTE
Description | Video is muted. |
Value Return Type | Boolean |
Player State: CHANGE_QUALITY
Description | User changed the quality of the video. |
Value Return Type | Int |
Player State: CHANGE_CAPTIONS
Description | User changed the captions. |
Value Return Type | TrackModel |
Player State: ORIENTATION_CHANGE
Description | The orientation of the screen changed. |
Value Return Type | Int |
Player State: VOLUME_CHANGE
Description | User changed the volume. |
Value Return Type | Float |
Player State: SHARE_CLICKED
Description | User clicked the share button. |
Value Return Type | Boolean |
Player State: VIDEO_BUFFERING
Description | Video is buffering. |
Value Return Type | Boolean |
Player State: VIDEO_BUFFERED
Description | Video buffered. |
Value Return Type | Boolean |
Player State: FULL_SCREEN_OPENED
Description | The video was set to full screen. |
Value Return Type | Boolean |
Player State: FULL_SCREEN_OPEN_INITIALIZATION
Description | Full screen initialization started. |
Value Return Type | Boolean |
Player State: FULL_SCREEN_CLOSE_INITIALIZATION
Description | Close full screen initialization started. |
Value Return Type | Boolean |
Player State: FULL_SCREEN_CLOSED
Description | The user exited out of full screen mode. |
Value Return Type | Int |
Player State: SETTINGS_OPENED
Description | Settings opened. |
Value Return Type | Boolean |
Player State: SETTINGS_CLOSED
Description | Settings tab was closed. |
Value Return Type | Boolean |
Player State: HELPER_BUTTON_CLICKED
Description | The user clicked the help button. |
Value Return Type | Boolean |
Player State: NEXT_VIDEO_CLICKED
Description | The user clicked the next video. |
Value Return Type | Boolean |
Player State: PREVIOUS_VIDEO_CLICKED
Description | The user clicked the previous video. |
Value Return Type | Boolean |
Player State: CHROME_CAST_CONNECTED
Description | Chromecast is connected. |
Value Return Type | Long (The current playback position) |
Player State: CHROME_CAST_DISCONNECTED
Description | Chromecast is disconnected. |
Value Return Type | Long (The current playback position) |
Player State: CAST_STATE_READY
Description | Cast state is ready. |
Value Return Type | Boolean |
Player State: CAST_STATE_BUFFERING
Description | Cast is buffering. |
Value Return Type | Boolean |
Player State: CAST_STATE_ENDED
Description | Cast ended. |
Value Return Type | Boolean |
Player State: CAST_QUEUE_MOVED_ITEM
Description | Cast moved in queue. |
Value Return Type | Boolean |
Player State: CAST_VIDEO_PLAYED_DIRECTLY
Description | Video played directly in cast. |
Value Return Type | VPVideoModel |
Player State: CAST_VIDEO_ADDED_TO_QUEUE
Description | Video added to queue in cast. |
Value Return Type | VPVideoModel |
Player State: CAST_VIDEO_QUEUE_CLEARED
Description | Queue has been cleared. |
Value Return Type | Boolean |
Player State: CAST_QUEUE_REMOVED_ITEM
Description | Cast item removed. |
Value Return Type | Int |
Player State: PLAYER_ERROR
Description | Player has an error |
Value Return Type | Boolean |
Player State: PLAYER_DRM_ERROR
Description | Player has DRM error. |
Value Return Type | Boolean |
Player State: VIDEO_AD_PLAYED
Description | Play video ad is requested. |
Value Return Type | Boolean |
Player State: PLAYER_RELEASED
Description | Player is released (ChromeCast or Player). |
Value Return Type | Long (Current playback position) |
Player State: PLAYER_INITIALIZED
Description | Player is initialized (ChromeCast or Player). |
Value Return Type | Long (Current playback position) |
Player State: RELATED_OPENED
Description | Related slding panel is expanded. |
Value Return Type | Boolean |
Player State: RELATED_CLOSED
Description | Related slding panel is collapsed. |
Value Return Type | Boolean |
Player State: RELATED_PLAYED
Description | Related item is clicked to play. |
Value Return Type | videoId |
Player State: CHANGED_VIDEO
Description | User changed the video. |
Value Return Type | Long (Current playback position) |