文件浏览器 JWPlayer.

Filebrowser for JWPlayer

本文关键字:JWPlayer 浏览器 文件      更新时间:2023-09-26

我想构建一个文件浏览器,它在单击时显示有关文件的信息。然后,文件本身应该加载到每个PHP的jwplayer中。

我可以通过单击文件以某种方式执行此操作吗?还是我应该使用 JavaScript?(我尽量避免)

通过 列出要列出的所有文件 通过 php 输出如下内容来创建文件浏览器:

<div id="player_container"></div>
<a href="./files/file.mp4" onclick="playjw(this)" />
<a href="./files/file2.mp4" onclick="playjw(this)" />
<a href="./files/file3.mp4" onclick="playjw(this)" />   ect

和功能

<script type='text/javascript'>
var temp;
var temphref; //these variables to get the href of the anchor back when opening 
              //another file so you could open the first file again

function playjw(file) {
var srcfile=file.href;

jwplayer('player_container').setup ({
'flashplayer': 'player.swf',
'file': srcfile,
'controlbar': 'bottom',
'width': '470',
'height': 320,
'provider': 'http'
});
return false; // this is required to not let the browser follow the link.

}
</script>

如果有任何错误,请自行更改功能,因为我可能忘记了某些东西

如果要使用文件浏览器,请使用基于 php/javasript 的脚本。不要试图自己构建它,除非你有太多时间。检查 http://www.gerd-tentler.de/tools/filemanager/和 http://encode-explorer.siineiolekala.net/explorer/index.php。网络上充满了优秀的免费脚本。根据您希望如何使用jwplayer(音频?视频?),您可以轻松创建播放文件的div(请参阅jw文档)或创建播放文件的iframe。

最简单的方法是为所有以创建div/iframe 的 .mpg 或.mp3结尾的文件创建一个 onclick 事件。