How to use the Vidyard Player API

The Vidyard Player API allows developers to control the behavior of an embedded player via Javascript.

API Script

Depending on whether you use Vidyard's inline and lightbox embed code or responsive embed code, the script used to control players differs slightly.

Locations you may retrieve these embed codes from, include:

  1. From a player(s) inside the Vidyard platform
  2. Through a request to the Vidyard dashboard API 
  3. As part of the integration process with the Vidyard GoVideo partner application

Inline & Lightbox Embed

<script type="text/javascript" id="vidyard_embed_code_[playerUUID] src="//[playerUUID].js?v=3.1.1&type=inline"></script>
<script src="//"></script>

Note the last line in script, <script src="//"></script>. This is what includes the Player API on the page. It must follow the player embed script.

Responsive Embed

The Vidyard responsive embed code has the Player API built-in. Place the initial part of the script inside the header of your webpage.

Make note that the api script must come before all instances of the responsive embed on the page.

The responsive embed also allows for multiple instances of the same player on a given page.

<!-- The script tag should live in the head of your page if at all possible -->
<script type="text/javascript" async src=""></script>

<!-- Put this wherever you would like your player to appear -->

Referencing a player

Players are referenced via their UUID. The UUID can be extracted from the player embed code or sharing page URL. 

For example: The player UUID is oTDMPlUv--51Th455G5u7Q.

Example for querying a player

Inline and lightbox embed

// Returns a specified player
// Replace playerUUID with the UUID of the player you would like to control with the API
var player = new Vidyard.player("playerUUID");;


// Returns all players with reference to one particular instance of a player
// Replace playerUUID with the UUID of the player you would like to control with the API
var players = new Vidyard.players(); 

Responsive embed

// returns a collection of players with the given UUID
var players = VidyardV4.api.getPlayersByUUID(UUID);


// get all players
var players = VidyardV4.players;




Start the player from the beginning
Pauses the player
Resumes playback

The player position will be changed to the desired time. The position value is the desired player's position in seconds

Set the player volume. The volume value is the desired player's volume represented between 0-1.
Toggles player between fullscreen and original dimensions (whichever is the opposite of its current state).
Play a designated video within the player. The index value is the desired video beginning at 0 for the first video.
Returns the index of the current video within the player.
Enables captions. The language and label values allow you to specify which caption to enable. If a value is not specified then this method will enable the first caption.
Disables captions. The language and label values allow you to specify which captions to disable. If a value is not specified then this method will disable all captions that are showing.
Returns player's current time as a decimal (in seconds)
*responsive embed only
Select the audio track according to the index of available audio tracks.
*responsive embed only
It is recommended that users assign events through the Vidyard platform. However, if necessary, you may pass an object that includes an eventID, start time, duration, and chapterIndex to dynamically assign an event to a player.

const objectOptions = {  eventId: 37359,  start: 4,  duration: 4, chapterIndex: 0 }
Fullscreen events do not require a duration. Events cannot be pre-roll or post-roll.

GDPR-specific methods

These methods were implemented in order to enable customers to achieve GDPR compliance on webpages where Vidyard players exist.

The methods are used to communicate to players whether a visitor has consented to having identified view data passed to Vidyard. Note that Vidyard.gdpr.consent calls set to true persist in localStorage, so visitors to your webpage do not need to accept tracking on every page load.

When players do not receive consent, only completely anonymized viewing data will be passed to Vidyard.

Vidyard.GDPR.consent ()
Sets consent for every player on your page to true or false.

This method assigns consent on a per subdomain basis.
Vidyard.GDPR.hasConsentOnReady (callback)
Callback receives true or false upon all player ready.

This function is intended to determine whether or not to display a consent prompt upon page load.


Vidyard.GDPR.hasConsentOnReady(function(consent) {
// Your callback logic goes here

Return player properties

Use player.metadata to return information about the player (title, length, description, public custom attributes, etc). This data is available after the ready event has fired. null is returned otherwise.

Example Response

  "chapters_attributes": [
      "video_attributes": {
        "description": null,
        "name": "nature",
        "tags": [],
        "thumbnail_urls": {},
        "captions": [
            "name": "English",
            "language": "en",
            "is_default": true,
            "vtt_url": "//"
            "name": "dansk",
            "language": "da",
            "is_default": false,
            "vtt_url": "//"
  "custom_attributes": [
      "attribute_type": "String",
      "is_public": true,
      "list_options": null,
      "name": "test_public",
      "value": "Test public"
      "attribute_type": "Number",
      "is_public": true,
      "list_options": null,
      "name": "test_public",
      "value": 10678
  "description": "",
  "height": 360,
  "length_in_seconds": 123,
  "name": "player name",
  "tags": [],
  "visitorID": "string",
  "width": 640


Use events to craft responses in reaction to a player's behavior.

Fired when the player has loaded on the web page.
This event fires when the player (re)commences playback.

Note: This function does not affect players when viewed on iOS devices.
This event fires when the player is paused.
This event fires immediately when the viewer seeks.


This event fires when the viewer has completed a seek action to a new postion in the player.
This event fires when the end of the player is reached regardless of any seeking or pauses.
This event fires when the end of a chapter is reached regardless of any seeking or pauses.
This event fires every ~100ms during playback.
This event fires when the volume is changed.

See our documentation for additional player API examples.

Was this article helpful?

Can’t find what you’re looking for? Please contact us below.

Email Vidyard Support
Why you didn't like the article?

If you would like Vidyard to get in contact with you regarding your feedback, please enter your email address.

  • No, Thanks