extra text in Vimeo Embedded videos

For a WordPress site I am working on, there is a jquery slider (based on the coda slider) where videos are presented.
All of the videos are from Vimeo.
If a video is playing and someone slides to the next video, the other video continues to play.
I have found some API code from Vimeo that allows me to control the video, so i could possibly add a “pause” class to the slider buttons that will pause videos when someone slides to the next video.

However; in order for this to work, I need an id added to the iframe tag, and this line of code to the end of the video player url: ?api=1&player_id=player_1 (except player_1 should be a unique id)

Read More

So the final output should look like this (except player_id number will be unique on each video):

<iframe id="player_1" src="http://player.vimeo.com/video/27421766?api=1&amp;player_id=player_1" width="670" height="377" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe>    

I wonder if there is a function I can create that will do this. I know there are some core files in WordPress where the embed code lives, but am hestitant to mess with that.

Related posts

Leave a Reply

2 comments

  1. I add a frame ID using an each function’s index, and then appending the src with the string you need:

    jQuery('#video-gallery-list li.video-player').each(function(i) {
        // set up a variable for the src that includes the new unique ID you're about to use
        var this_src = jQuery(this).find('iframe').attr('src') + '?api=1&amp;player_id=player_'+i;
        jQuery(this).find('iframe').attr('ID', 'player_'+i).attr('src',this_src);
    });
    
  2. Okay, by much digging around I was able to find a patch someone had created for the class-oembed.php file in WordPress that allows for additional arguments to be sent to oEmbed (normally you are only able to send the “Width” and “Height”. The patch I found here: http://core.trac.wordpress.org/attachment/ticket/16996/16996-2.diff
    Using that was able to send additional arguments oEmbed along with the URL like so:

    return $wp_embed->shortcode( array('width' => $width, 'height' => $height, 'api' => 1, 'player_id' => $postID), $videoURL );
    

    I still have not found a way to return an ID for the iframe, but I THINK that I can work around that because in my particular instance I do not need to choose one particular Video on a page…I just need to create a button that will pause all videos that are running.