Support » Plugins and Hacks » WordPress Video Plugin » [Plugin: WordPress Video Plugin] how to play youtube videos one after another

[Plugin: WordPress Video Plugin] how to play youtube videos one after another

  • Hi,
    I was wondering if is possible to auto play youtube videos in sequential?

    for example [youtube xjidjdj, sjdijidjsi, jdij8j33, ue9jdjf]

    It will show there’re 4 parts to it, and once the first video finises, the second one starts automatically.

    i got some code but don’t know how to integrate into video plugin

    /* Youtube Player */
    var ids = new Array();
    var curId = 0;
    function SetupVideoPlayer() {
    ids = $(".video_ids").text().split(',');
    if (ids.length > 1 && ids[0].length > 4){
    $('.node_body').append("<div class=\"video_wrapper\"></div>");
    $('.video_wrapper').append('<div class="video_note">Subsequent part(s) will play automatically when the current part finishes playing.</div>');
    $('.video_wrapper').append('<div id="ytapiplayer">You need Flash player 8+ and JavaScript enabled to view this video.</div>');
    $('.video_wrapper').append('<div class="video_nav"></div>');

    var params = { play: "false", allowScriptAccess: "always", allowFullScreen: "true", wmode:"transparent" };
    var atts = { id: "myytplayer", play: "false" };
    "ytapiplayer", "680", "500", "8", null, null, params, atts);

    if (ids.length > 1){
    for (i=0;i<ids.length;i++)
    $('.video_nav').append('Part ' + (i+1) + ' ');
    if (ids.length == 1)
    $('.video_nav .part_0').addClass("active_part");

    return false;

    var first_time_video_load = true;
    var ytplayer;
    function onYouTubePlayerReady(){
    ytplayer = document.getElementById('myytplayer');
    ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
    if (!first_time_video_load)
    first_time_video_load = false;

    function onytplayerStateChange(newState) {
    if (newState == 0 && curId < ids.length - 1){
    PlayPart(curId + 1);

    function ResetPartLinkWeight(){
    for (i=0;i<ids.length;i++)
    $('.video_nav .part_' + i).removeClass("active_part");
    function PlayPart(n){
    if (n>=0 && n<ids.length){
    if (ytplayer) {
    setTimeout("ytplayer.loadVideoById('"+ids[n]+"')", 1000);
    curId = n;
    $('.video_nav .part_' + n).addClass("active_part");

    function FetchSelectedShoutcast() {
    comment_parent_id = $(this).attr("href").split('v=')[1];
    $(".videos").animate({marginRight:310}, "slow");
    $(".right_side_panel").animate({width:310}, "slow");
    $.get("/ajax/comment/", {t:"shoutcast", id:comment_parent_id}, function(response){
    $(".comments_wrapper").fadeOut("slow", function(){



Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author daburna


    Hi radiofranky,
    thanks for your code! I will test and think about the integration into my plugin. With this code it is not possible to change the videosize like [youtube id width height] or? So I have to write an admin page and make the size configurable via variables.

    i think you can passing in size variable… it’s very similar to your current code.

    Please keep me posted if you get chance to add this code to your plugin.

    If you need beta tester, I’m in.


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WordPress Video Plugin] how to play youtube videos one after another’ is closed to new replies.
Skip to toolbar