Drew Baker

Drew Baker

Hey Guys,
I'm thinking about building an advanced plugin to WordPress and was wondering if it's possible to send a player a new source file to play? Or do I have to re-embed the player everytime a user wants to change videos?

I was hoping for something like this in the JavaScript API:
{"method": "play","value": "vimeo.com/20744468";}

I would then bind that method to a thumbnail of a video for example.

Thanks for the help!

Brad Dougherty

Brad Dougherty Staff

The easiest way is to use the iframe embed and change the src attribute.

Drew Baker

Drew Baker

So if I change the src attribute using JavaScript, the Flash Player (and HTML5 player) will update the the playing video in realtime? If so, that's amazing!

Brad Dougherty

Brad Dougherty Staff

It won't continue to play, it will just load the new video. (But you could add ?autoplay=1 to have it start)

Drew Baker

Drew Baker

Thanks Brad, this is great. Is that how you guys are doing it here?
vimeo.com/channels/staffpicks

It seems a little inefficient to have to reload the flash player everytime, but that's a very easy way to do it.

Patrick Gibson

Patrick Gibson

Hi Brad, I'm using this idea for a site I'm building and using jquery to swap the src attribute. However it doesn't seem to be taking any of the "color" or "autoplay" attributes. Any ideas?

Website below!

Thanks a lot

Link: stephencollinsmusic.com/

Silver Sound

Silver Sound Plus

Hi Brad. Thanks for the comment. I'm using froogaloop and it makes sense to me that there should only be one player object in which I can change the video for. So, given you comments, I'm changing the iframe src attribute and now I'm going to try and grab the video w and h to update the iframe width and height. Does this sound good? Would it make more sense for froogaloop to have a command, like, loadVideo(id)?

Also: As you probably know, to "respect bandwidth," ios does not let videos start automatically or start through external controls. Therefore, i disable all my external controls (play/pause button) until the user presses play on the video itself. That's great - but my application loads videos on the fly - and each time I have to re-enable the vimeo controls on pause or end of play. Not so bad, but it would be nice if I could queue videos in with the iframe api and then seek, avoiding multiple touches. Is something that I can do already and missed?

-David

This conversation is missing your voice. Please join Vimeo or log in.