一、通过官网发布向导
登陆 http://www.longtailvideo.com,注册一个账号,进入你的用户管理中心,如下图
然后按提示,一步步操作,就会得到js代码了。
二、自己服务器发布
<script src="http://xx.com/jwplayer/js/jwplayer.js" type="text/javascript"></script> <script src="http://xx.com/jwplayer/js/jwpsrv.js" type="text/javascript"></script>
<script type="text/javascript"> jwplayer("container").setup({ html5player:"http://xx.com/jwplayer/js/jwplayer.html5.js", flashplayer:"http://x.com/jwplayer/js/jwplayer.flash.swf", file: "http://xxp.com/jwplayer/uploads/1.mp4", image: "http://xx.com/jwplayer/uploads/snapshot.jpg", title:"来自PANDA的视频" }); </script>
三、两种发布方式的区别:
官网向导方式,我们会得到
<script src="http://jwpsrv.com/library/dO5_Ul5aEeO5FBIxOQfUww.js"></script>
这个js内容和最新版的jwplayer.js一致,随机字符串用于统计,这样我们在官网登陆账号去看数据概况。
四、注意事项:
1、Note two very common issues prevent smooth playback of videos in Internet Explorer 9/10. First, you need to set <!DOCTYPE html> to prevent triggering IE's quirks mode. Second, your videos must be served with the video/mp4 mimetype or IE will refuse to play them.
测试的时候,发现chrome对格式也有要求,错误如下:
能显示截图,但是播放时就提示不能播放。然而,在本地是可以播放。暂时原因不明,以后补上!------
后来,换成官网demo的MP4文件,在各主流浏览器下测试通过。
测试时,jwplayer.html5.js 版本号:6.0.4296
2、嵌入方式
Note this is also the only embed syntax JW Player supports. Setups using a <video>, an <embed> tag or SWFObject will not work with JW Player 6.
即jw6只能通过js方式嵌入。setup方式