从视频列表中选择后,视频无法播放 [英] Video is not playing after select from a video list

查看:72
本文介绍了从视频列表中选择后,视频无法播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经从我的数据库中动态创建了一个视频列表。为此,我在php中完成了我的代码:

Hi,
I have dynamically created a video list from my database. For that I have done my code in php:

$query = "select post,link from pagination order by id desc
limit $pageLimit," . PAGE_PER_NO;
$res = mysql_query($query);
$count = mysql_num_rows($res);
$HTML = '';
$countli = 1;
if ($count > 0) {
while ($row = mysql_fetch_array($res)) {
        if ($countli == 1) {
            $post = $row['post'];
            $link = $row['link'];
            $HTML.='<li class="active"><div>';
            $HTML.='<video ><source src="' . $link . '" /source>' . '<p>' . $post . '/<p>';
            $HTML.='<a href="#"  önClick="javascript:vidSwap('. $link.'); return false;">Link</a></video>';
            $HTML.='</div><br/>';
            $HTML.='</li>';
            $countli = $countli+1;
        }
 else {
     $post = $row['post'];
            $link = $row['link'];
            $HTML.='<li><div>';
            $HTML.='<video ><source src="' . $link . '" /source>';
            $HTML.='<a href="#"  önClick="javascript:vidSwap('. $link.');">Link</a></video>';
            $HTML.='</div><br/>';
            $HTML.='</li>';
            $countli = $countli+1;
 }
    }
} else {
    $HTML = 'No Data Found';
}
echo '<ul id="playlist">';
echo $HTML;
echo '</ul>';



因为,在加载我的页面时,它会自动生成一个视频列表。在我的html页面中有一个视频播放器。代码:


As, while loading my page it automatically generate a video list. And in my html page there is a video player. Code:

<pre lang="HTML">
<div id="leftcolumn">
                            <video id="myvideo" controls='true' style="width:820px;height:360px"

                                preload="auto">
                            </video>
                        </div>





我的javascript代码是:



And my javascript code is:

<script type="text/javascrpt">
            function vidSwap(vidURL) {
            var myVideo = document.getElementById()('#myvideo')[0];
            myVideo.src = vidURL;
            myVideo.load();
            myVideo.play();
            }
        </script>





但是,当我点击列表中的视频文件时它的工作。哪个问题我不明白。



But, when I am clicking in a video file from the list its working. Where is the problem I don''t understand.

推荐答案

查询 = < span class =code-string>选择帖子,通过id desc
limit
query = "select post,link from pagination order by id desc limit

pageLimit,从分页顺序链接。 PAGE_PER_NO;
pageLimit," . PAGE_PER_NO;


res = mysql_query(
res = mysql_query(


这篇关于从视频列表中选择后,视频无法播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆