我将视频文件存储在文件系统中,并将路径存储在数据库中。我可以使用js和jquery显示视频。我想在单击列表。但是只有第一个视频是在这里玩这是我的密码
<script type="text/javascript">
function fn() {
var player = document.getElementById("videoclip");
var mp4Vid = document.getElementById("mp4video");
var a = '/site_media/media/';
var b = document.getElementById("btn").value;
var c = a + b;
player.pause();
document.getElementById("mp4video").src = c;
player.load();
player.play();
}
</script>
<body>
<div align="right">
<table border='1'>
<tr><th>slno</th> <td>Filename</td></tr>
{% for i in total %}//total contains the video paths(python)
<tr>
<td>{{ forloop.counter }}</td>
<td align="center">
<input type="button" onclick="fn()" id="btn" value="{{ i.vid }}"/>
</td>
</tr>
{% endfor %}
</table>
</div>
<div align="center">
<video id="videoclip" width="320" height="240" controls='controls' autoplay>
<source id= "mp4video" src="/site_media/media/upload/vid2.mp4" type="video/mp4">
</video> <br></div>
</body>
id必须是唯一的本文件:你知道吗
然后在jquery中代码:-你知道吗
相关问题 更多 >
编程相关推荐