Sally Maier
Sally Maier

Reputation: 63

Disable Autoplay in Vimeo video with specified start time

I have an embedded Vimeo video that has a specified start time. Videos with a specified start time autoplay by default, this is a known issue that Vimeo seems to refuse to address. https://vimeo.com/forums/topic:49396

I assume that there is a way to stop the video from playing anyway using the API, but I haven't gotten it to work. The video is actually pulling from an embed on Behance, so I can only modify the embed code so much (classes and IDs get stripped out).

Here's what the rendered HTML looks like:

<div class="modules embed alignment-center caption-">

          <img class="mod-image" src="">
          <iframe src="https://player.vimeo.com/video/166768461#t=89m24s?autoplay=0" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" style="margin:0px auto;display:block;width:600px;height:338px;"></iframe>
</div>

and my jquery with froogaloop loaded:

$(document).ready(function() {

// ... calling behance api, setting up mustache.js templates if that's relevant ...

        var iframe = $('iframe')[0],
        player = $f(iframe),
        status = $('.status');

        player.addEvent('ready', function() {
            player.api('pause');
        });

}); //end of document

No dice, and I'm about to scream if I hear the intro music play one more time when my code fails.

Upvotes: 2

Views: 2475

Answers (1)

Sally Maier
Sally Maier

Reputation: 63

The code above actually works, but it needs to be placed directly after I activate mustache on that section. Answering because I'm sure others are looking for how to disable the autoplay on timestamped videos.

var iframe = $('iframe')[0],
    player = $f(iframe),
    status = $('.status');

player.addEvent('ready', function() {
    player.api('pause');
});

Upvotes: 2

Related Questions