- Print
- DarkLight
- PDF
List of supported Methods and events for the player
Method | Parameters | Notes |
---|---|---|
play() | Plays the video or advertisement from a stopped/paused state | |
pause() | Pauses the video or advertisement from a playing state | |
destroy() | Destroys the video player, stops any processes, and does any necessary clean-up. (If a player instance is no longer needed, this method must be used | |
setAdUrl | adUrl: String | Use this method to show an ad on the video player |
goFullScreen() | videoID: String | Use this method to move the video player in full-screen mode |
removeFullScreen() | Use this method to move the video player in small screen mode - If there is no small-screen player “mode”, this method will remove the full-screen video player from the screen | |
seekTo() | milliseconds: long | Use this method to seek current playing video to a specific position |
getCurrentTime() | Return current time of video being played | |
getSource() | Return source of video being played. Returns dictionary - name and id | |
isMuted() | Return (true/ false) state of volume (mute or not) | |
getVolumeLevel() | Returns value of volume currently video is played (0~100) | |
getState() | Returns state of player - Paused, Playing, Playing+Casting, Buffering, Complete, Error, Advertisement | |
getPlayerVersion() | Returns version of Viewlift player SDK version | |
getCurrentVideoTimeLeft() | Returns time left of video playback in long | |
getCurrentVideoDuration() | Returns total video duration in long | |
hideController() | Hides the controller | |
showController() | Show the controller | |
getNetworkInfo() | Returns current network speed info. Returns dictionary - quality & speed | |
setCaptionsVisibility() | captionsVisible: Bool | Show/hide closed caption text |
setFullscreenButtonOff() | disable: Bool | Disable the fullscreen button functionality |
setNextVideo() | videoID (String) - required | Add only one video in the queue, next in line to play when the current video is finished |
playNextVideo() | token (String) - optional; videoID (String) - optional | If no params are entered it will play right away the next video in the queue if is any with the token entered from setSource method. If token or videoID params are entered it will play right away video based on these params. |
playPreviousVideo() | token (String) - optional | If no token is entered it will play right away the previous video in the queue if is any with the token entered from setSource method. If the token is entered it will play right away the previous video with this token. |
addVideos() | videoIDs (List | Add list of ids entered to the queue. (only unique values) |
removeVideo() | videoID (String) - required | |
removeAllVideos() | Remove all IDs in the queue except the current video ID | |
getCurrentPlayList() | Returns a List | |
getCurrentPlayListPosition() | Returns an int which is the position in the queue of the current video | |
goLive() | This method works only when is a livestream video. If livestream is in a pause state this method can be called and it resumes the video in livestream state. | |
setAnimatePlaybackControls Enable() | Enables animation for playback controls whenever they show up or hide | |
setActivityInstance() | Sets activity instance to enable PIP. Must be called before pipClick | |
pipClick() | Bring player activity to picture-in-picture mode | |
setProgressBarSize() | width(int) - required height(int) - required | Sets the size of progress bar |
setProgressBarIcon() | drawable (Drawable) - required | Sets Progress bar drawable |
hideError() | Hide player error view |
List of supported Events
In order to listen for these events, add this line after your activity class name:implement VLPlayerVideoEventListener class in your activity
implements VLPlayerVideoEventListener
...then implement its methods.
Event | Parameter | Description |
---|---|---|
videoStarted() | playerTag: String | Fired when the video starts playing |
videoPaused() | currentTime: long | Fired when playback is paused |
videoResumed() | currentTime: long | Fired when the video has resumed from a paused state |
videoFinished() | currentTime:long | Fired when the video has finished |
videoPlaybackError() | currentTime: long | Fired when the player has an error playing the video |
onFullScreenChange() | currentTime: long | Fired when there is a change in player fit - small-screen player, full-screen player |
onSeek() | currentTime: long | Fired when the video is sought from the progress bar |
onBuffer() | currentTime: long playerTag: String | When video playback is stalled due to buffering |
onApiResponseBodyNull() | error: String playerTag: String | When API returns a null response |
onFullscreenButtonClick() | playerTag: String | When clicked on the fullscreen button |
For Ad events
In order to listen for Ad events, implement VLPlayerAdEventListener:
implements VLPlayerAdEventListener
Event | Parameter | Description |
---|---|---|
onAdStarted() | playerTag: String | Fired when the ad starts |
onAdPaused() | playerTag: String | Fired when the ad is paused |
onAdResumed() | playerTag: String | Fired when the ad is resumed |
onAdSkipped() | playerTag: String | Fired when the ad is skipped |
onAdFinished() | playerTag: String | Fired when the ad has finished |
onAdTapped() | playerTag: String | Fired when the ad is tapped |
OnAdClicked() | playerTag: String | Fired when the ad is clicked |
onAdError() | error: String | Fired when an error happens in the ad |
List of PlayList events
For PlayList events implement VLPlayerPlayListEventListener:
implements VLPlayerPlayListEventListener
Methods to be implemented are:
Event | Parameter | Description |
---|---|---|
onVideoRemove() | playerTag: String | Fired when a single video ID is removed from the queue |
onVideosRemove() | playerTag: String | Fired when all video IDs are removed from the queue. (except the current video ID) |
onVideosAdd() | playerTag: String | Fired when one or more IDs are added to the queue |
onVideoListFinished() | playerTag: String | Fired when the current video is finished and there are no more video IDs next in the queue to play |
List of Custom Player events
When custom player view is set these events can be used:
implements VLPlayerCustomEventListener
Methods to be implemented are
Event | Parameter | Description |
---|---|---|
onTitleTextSet() | title: String | Fired when the text is available from JSON. |
onDurationViewChange() | time: long formattedTime: String | Fired in every second when the video is playing. |
onPositionViewChange() | time: long formattedTime: String | Fired in every second when the video is playing. |
onCurrentVideoTimeLeft() | time: long formattedTime: String | Fired in every second when the video is playing. |
List of PIP Events
Event | Parameter | Description |
---|---|---|
onPictureInPictureModeChanged() | Boolean:isInPictureInPictureMode, Configuration: newConfig | Fired when player activity enters or exits the pip mode. |