最近使用wordpress开发一个视频网站,客户要求使用这个播放器,使用方式
一、下载jwplayer(下面有下载链接),应用js文件到项目中。
<script type="text/javascript" src="/statics/jwplayer/jwplayer.js"></script> <script type="text/javascript">jwplayer.key="W+FSSIJICMeqqi4MQCwmdLePq9iq8HQqiVT5dQ==";</script> <script type="text/javascript"> var thePlayer; function plays(url,autostart,title){ thePlayer = jwplayer('video').setup({ flashplayer: '/statics/jwplayer/jwplayer.flash.swf', image:"<?php the_post_thumbnail_url();?>", width: 820, file:url, height: 414, autostart:autostart, dock: false , }); $('.video_title').html(title); } $(function(){ plays("<?php echo $video_list[0]->video_url;?>",false,"<?php echo $video_list[0]->video_title;?>"); $('.dlinfo2 a:eq(0)').addClass('checkeds'); }); </script>
jwplayer.key 是播放器key值,没有这个值不能播放。 video是放置视频的id,如 <video style="height: 100%;width: 100%;" id="sxt" controls preload="none" autoPlay="autoPlay"></video> flashplayer是jwplayer提供的flash文件,image是播放前的默认图片,具体的参数解释可以百度
二、文件下载