M -
M -

Reputation: 28462

Vimeo's JS API: player.loadVideo() method resets player options to its defaults

I'm using Vimeo's player.js API, where it states that you can set options on the player, such as title: false when initiating the Player object as follows:

var options = {
    id: 59777392,
    title: false
};
var vimPlayer = new Vimeo.Player('myDiv', options);

As expected, the video player shows up without a title:

No title!

However, upon user interaction, I want to load a different video into the same player, using the loadVideo() method:

player.loadVideo(76979871);

Upon doing this, the option of title: false gets overridden, and all subsequent loads show the title:

Yes title!

Does anybody know how to make title: false stick? I've also tried adding the options in attribute format on the div itself using data-vimeo-title="false", as the API suggests, but once again, it only works upon first load.

I also tried passing options on loadVideo(), but it doesn't accept any additional parameters, besides the video ID.

Upvotes: 1

Views: 1363

Answers (1)

Ryan Vettese
Ryan Vettese

Reputation: 514

maybe create a function to do this.

var vimPlayer;

function loadVideo(videoId) {

    var options = {
        id: videoId,
        title: false
    };

    vimPlayer = new Vimeo.Player('myDiv', options);
}

loadVideo(59777392);

and from the user interaction

loadVideo(76979871);

Upvotes: 1

Related Questions