Player Methods

API.loadVideo(video, [play])

  • Changed the video currently in the player
  • Parameters:
    • video – video ID to be loaded
    • play – [optional] whether to auto play the video, only able to do this on your own videos and if a user has already clicked on the player before

API.getCurrentVideo()

  • Returns an object with the following:
    • id - the video ID
    • link - Link to the video on rumble.com
    • own - Whether the video is your own video
    • plays - Number of times this video has been played
    • thumb - Thumbnail of the video
    • title - Title of the video

API.setAds(type, ads, allowFallback)

  • This will replace the current ads in the player for the type specified. If you call this twice the ads from the second call will be used and the previous ones will be cleared.
  • Parameters:
    • type - preroll or overlay
    • ads - array of vast feeds to use, if the first fails the next feed will be called
    • allowFallback - [optional, default: true] true/false – If set to false all ads that are not owned by you will be excluded. Normally fallback ads are included after your ads, so only after all your vast feeds fail will a fallback be called.
  • Returns true or false if the call was successful. Most common reason for failure is if you do not own the video.

API.getAds(type)

  • Returns an array of all ads set up for the current video for the given type. For all vast feeds from the Rumble ad stack/fallback the value “Rumble Ad Stack” will be returned.
  • Look to setAds to see the possible values for type.

API.play([force])

  • Plays the video loaded. This function will only be successful if one of the following conditions are met:
    1. The video has already played and has since been paused or ended
    2. You own the video and the player has previously been clicked on.
    3. You own the video and you call the function with true for the force optional parameter.
  • Please note that if the video has not be interacted with previously and you try to force the video the browser may block it unless you mute the video first.

API.pause()

  • Pauses the current video if it is playing

API.getPaused()

  • Returns true or false depending if the video is playing or not.

API.mute()

  • Mute the volume on the player

API.unmute()

  • Un-mute the volume on the player

API.getMuted()

  • Returns true or false whether the player is muted

API.setVolume(vol)

  • Sets the volume on the player. The value passed should be between 0 and 1 inclusively, with 1 being full volume. If the player is muted this will unmute it automatically.

API.getVolume()

  • Returns the volume of the player. If the player is muted the value for this will be 0

API.getDuration()

  • Get the length of the currently loaded video in seconds

API.setCurrentTime(time)

  • Seek the current video to the time in number of seconds, if the video is playing it will skip to the time and continue playing.

API.getCurrentTime()

  • Get the current time of where the video is playing in seconds.

API.off(eventName, [func])

  • Removes event listeners on the player. All functions are removed if the optional “func” parameter is not provided, otherwise the function provided in “func” is only removed”. A list of all events available is listed in API.on

API.on

  • Add an event listener to the player. An object is passed to your function if there is need for more than one value for the event. Here is a list of available events.
Event Name Event passed to function Description
loadVideo When a video is loaded from the server and is ready
resize When the player has resized and the UI updated due to it
preplay Right before the video is played, best time to set the ads is here or on “preAd”
preAd Type of ad Fired before attempting to run an ad
play After the play call is made to the video, this is where ads are fired if there is a reason to.
pause Fired when the video player is paused
mute The new volume value Fired when the video is muted or unmuted
volumeChange The new volume value Fired when the volume has been changed
videoEnd The time in seconds of the video When the video has come to an end, best time to show an overlay
ui True/false wheter the player’s UI is shown Fired when the player’s UI changes state
adError Object:
{code: errCode, msg: message}
Fired if an error occurs in any of the ads
adImpression Object:
{ad: curAd, adType: type, linear: isLinear}
Fired when an ad impression is called
adClick Same as adImpression Fired when an ad has been clicked

results matching ""

    No results matching ""