jwplayer 部署方案1

<body>
<div id="my_player" data_src="http://xx.com/jwplayer/uploads/test.mp4"></div> <script src="http://xx.com/jwplayer/player_core.js" type="text/javascript"></script>
<script src="http://xx.com/jwplayer/playfile.js" type="text/javascript"></script>
</body>

其中:

player_core.js内容:

(function() {
//加载核心文件
document.write("<script src='http://xx.com/jwplayer/js/jwplayer.js' type='text/javascript'></script>");
//加载srv
document.write("<script src='http://xx.com/jwplayer/js/jwpsrv.js' type='text/javascript'></script>");
})();

playfile.js内容

(function(){
var div=document.getElementById("my_player");
var url=div.getAttribute("data_src");
//播放器初始化
if(jwplayer!=null){
jwplayer("my_player").setup({
html5player:"http://xx.com/jwplayer/js/jwplayer.html5.js",
flashplayer:"http://xx.com/jwplayer/js/jwplayer.flash.swf",
file: url,
repeat: 'true',
primary: 'flash'
});
}
})();

这种为简易实现版,放在页面body的底部即可。

对于第二个js请求,可以搭建一个服务器,进行转换解析。可以支持更多的参数提交。

上一篇:Fragment详解-android学习之旅(四十八)


下一篇:jwplayer 参数记录