Skip to content Skip to sidebar Skip to footer

How To Use A While Loop For Flow Player In Php?

I have videos that are coming from the server. The first video player works fine but the rest is empty not sure why here is what i have right now. while($row = mysql_fetch_assoc($q

Solution 1:

You can replace the id for a class and initialise the players targeting the class name.

Example

Php/Html

while($row = mysql_fetch_assoc($query12))
{                               
    echo"<ahref='$urls'style='display:block;width:520px;height:330px'class='player'></a><br/><br/>";
}

JS

<script>flowplayer("a.player", {
    src:"flowplayer-3.2.16.swf",
    wmode: "opaque"// This allows the HTML to hide the flash content
    }, {
        clip: {
        autoPlay: false
       }
    });
</script>

This will now setup multiple players on your page.

Solution 2:

you might be looking for something like the following because id's are supposed to be unique

$i = 1;
while($row = mysql_fetch_assoc($query12)){                               
    echo"... id='player-$i' ...";
    $i++;
}

<script>
var num = <?phpecho$i;?>;
for(i = 1; i <= num; i++){
    flowplayer("player-" + i, 
        {
            src:"flowplayer-3.2.16.swf",
            wmode: "opaque"// This allows the HTML to hide the flash content
        },
        {
        clip: {
            autoPlay: false
        }
    });
}
</script>

or it looks like you could do:

while($row = mysql_fetch_assoc($query12)){                               
    echo"... class='myplayer' ...";
}

<script>
flowplayer("a.myplayer", 
    {
        src:"flowplayer-3.2.16.swf",
        wmode: "opaque"// This allows the HTML to hide the flash content
    },
    {
    clip: {
        autoPlay: false
    }
});
</script>

Post a Comment for "How To Use A While Loop For Flow Player In Php?"