php - JWPlayer 文件浏览器

标签 php javascript function jwplayer

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

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

最佳答案

通过 listin 所有你想通过 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 - JWPlayer 文件浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10774409/

相关文章:

php - mysql 语法说明 ' ' = ' '

javascript - 为什么提交表单会覆盖提交按钮单击处理程序中的设置 location.href?

php - PHP/JS/DOM 中的引号

c++ - 为什么函数不能在 C 中有引用参数?

php - 使用 array_walk_recursive 从类中调用函数

php - PHP 中的闭包或 create_function

php - 与php算术相关

php - 如何使用 HTTP 管道通过单个 TCP 套接字发送 PHP cURL 句柄?

javascript - 将数据从表更新到数据库?

postgresql - Postgres 函数 : how to return the first full set of data that occurs after specified date/time