I would like to build a file browser, which displays information about the file when clicking. The file itself should then be loaded into jwplayer per PHP.
Can I somehow do this by clicking on the file? Or should I use JavaScript? (which I try to avoid)
create a file browser by listin all files that you want to list by php outputing something like :
<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
and the function
<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>
change the function by yourself if any bug will ocour because i might have forgot something