Search code examples
phphtmlflashflowplayer

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($query12))

{                               
echo"<a  
href='$urls'
style='display:block;width:520px;height:330px' 
id='player'> 
</a> 
<br/>                           
<br/>";
}

And this is for the Flow Player

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

Solution

  • 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"<a  
        href='$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.