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.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(eventName, func)

  • 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
adComplete Fired when the ad finishes/completes
adCompanions Array of companion ads Fired when an ad has companion banners
adRequest Object:
{url: ad_url, callback: callback_function}
This event only fires on your own ad tags. If you return a value from this event it will modify the current request.

Return:
false - will skip this ad
true - will make the player wait till the callback_function is called where you can pass a value as a parameter to modify the request
string - passing back a string will change the ad request to the string, this allows you to implement prebid or can be used as another way to add additional information/macros to the request
undefined - continues with the ad request untouched

results matching ""

    No results matching ""