Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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)

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.

share|improve this question
    
Okay. I am on the slow track to solving this. .. –  endle.winters Oct 20 '11 at 18:05

2 Answers 2

I just return the frame id using an each function:

jQuery('#video-gallery-list li.video-player').each(function() {
    var iframeID = jQuery(this).find('iframe').attr('ID');
    // do what you want with the iframeID
});
share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.