WordPress.org

Ready to get started?Download WordPress

Forums

Viper's Video Quicktags
Integrating with the YouTube API (2 posts)

  1. marctytus1
    Member
    Posted 4 years ago #

    Can there be an option to enable the YouTube API by passing in the parameter ?enablejsapi=1 in SWFObject? (YouTube JS Player api reference) A useful addition would also be also passing something like &playerapiid=postid

    What do you think about this?

    Here's a supplementary explanation of what I'm trying to do: All my posts contain YouTube videos. I'd like the individual post pages to autoplay videos but I want the default to not autoplay (so that my home page doesn't autoplay 20 or so videos at once.) Secondly, using a plugin like Random Redirect, I want to open example.com/~random after the YouTube video finishes playing, for continuous playback. And I think these things could be accomplished using the API.

    Anyway, thanks again for the plugin. I find it inspiring as someone who's just learning as he goes.

  2. Alex Mills (Viper007Bond)
    Moderator
    Plugin Author

    Posted 4 years ago #

    For random, yes, the JS API could probably do that. I'll include it in my next major release.

    For autoplay, try adding this to your theme's functions.php:

    add_filter( 'vvq_shortcodeatts', 'marctytus1_vvq_tweaker', 10, 3 );
    
    function marctytus1_vvq_tweaker( $atts, $type, $origatts ) {
    	if ( is_singular() )
    		$atts['autoplay'] = true;
    
    	return $atts;
    }

    That'll enable autoplay when in single post view.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic