0

我有来自服务器的视频。第一个视频播放器工作正常,但其余的都是空的,不知道为什么这是我现在拥有的。

while($row = mysql_fetch_assoc($query12))

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

这是给流播放器的

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

2 回答 2

1

您可以替换idfor aclass并初始化针对类名的播放器。

例子

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>

现在,这将在您的页面上设置多个播放器。

于 2013-08-27T12:18:23.260 回答
0

您可能正在寻找类似以下的内容,因为id's 应该是唯一的

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

<script>
var num = <?php echo $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>

或者看起来你可以这样做:

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>
于 2013-08-24T04:38:18.593 回答