我想整合php和js来观看视频播放器

时间:2014-12-02 10:34:33

标签: javascript php video jplayer

在这个页面上,在底部,我留下了部分证券而右边你应该打开一个玩家,你应该打开对应于所点击的标题的视频。 现在我可以将视频的路径转到点击的数据库的标题,所以:

                        <div id="down">

                            <div id="downSx">
                          <?php
ob_start();
$host = "**";
$username2 = "**"; // Mysql username
$password = "**"; // Mysql password 
$db_name = "**"; // Database name

//connect to db
mysql_connect($host, $username2, $password) or die("cannot connect");
mysql_select_db($db_name) or die("cannot select DB");


$i=0;
$h=0;
$result = mysql_query("SELECT * FROM videoMultimedia ");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
?>

     <div class="titleSxDown">
         <a class="preset_text" id="<? echo $h++ ?>"><? echo $row[3] ?></a>
     </div>
<?     
}
$result = mysql_query("SELECT * FROM videoMultimedia ");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
?>
     <input type="hidden" value="
     <? if($row[1] != ""){
     echo $row[1];
     }else{
     echo $row[2];
     }

     ?>


     " id="link_content_<? echo $i++ ?>" /> 

<?     
}     
mysql_free_result($result);  

ob_end_flush();
?>

</div>

                         <div id="downDx">
                                <div class="descrizioneDxDown">

                                </div>
                            </div>

                            <script type="text/javascript">
                                $(document).ready(function() {
                                    $('.preset_text').click(function() {
                                        var target = $(this).attr("id");
                                        $('.descrizioneDxDown').html($('#link_content_' + target).val());
                                    });
                                });
                            </script>

我不能不&#39;输入此脚本中的路径(脚本是播放器(JPlayer)):

                  <script type='text/javascript'>
                      jwplayer('descrizioneDxDown').setup({
                          file: 'pathVideo',
                          image: 'pathIMG',
                          title: 'TITLE',
                          width: '100%',
                          aspectratio: '16:9'
                      });
                  </script>

这是我网站的网址:http://www.fifaitaly.altervista.org/index.php

我该怎么办,谢谢!

1 个答案:

答案 0 :(得分:0)

jsplayer接受id ..您正在提供class

将类更改为id:

<div id="descrizioneDxDown">  // you are not doing this

</div>

现在你必须建立一个播放列表并把它放在:

<script>
    jwplayer("descrizioneDxDown").setup({
      playlist: "/path_to_your_Playlist.rss",
      width: 720,
      height: 270,
      listbar: {
        position: "right",
        size: 240
      }
    });
</script>

Found Here