JW Player read from php

对着背影说爱祢 提交于 2019-11-30 16:48:15

Since you are using JW6, here, under this line of code:

'id': 'playerID',

Add the following:

'type': 'mp4',

Now, the php file should work as the player's "file" variable, just fine.

Try:

clearstatcache();

header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Content-Type: video/mp4");
header("Accept-Ranges: bytes");
header("Content-Length: ".filesize("videos/testvid.mp4"));
readfile("videos/testvid.mp4");

I'm having the same scenario (read video from php and play it with jwplayer) and this configuration works.

JS

On the client side, I embed jwPlayer as a SWFObject. Check if it's useful for you:

<script type="text/javascript">
$(document).ready(function(){
  var so = new SWFObject('path/to/jplayer.swf','mpl',640,480,'9');
  so.addParam('allowfullscreen','true');
  so.addParam('allowscriptaccess','always');
  so.addParam('wmode','opaque');
  so.addVariable('controlbar','over');
  so.addVariable('provider','video');
  so.addVariable('autostart','true');
  so.addVariable('file','loadfile.php');
  so.write('videoPlayer');  
});
</script>
<body>
    <div id='videoPlayer'></div>
</body>

Also try using absolute paths (just in case)...

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!