首先,我们应该让 jwplayer 的 javascript 来构建 html 代码。
用js初始化jwplayer,在html中使用html5视频,如下:
<center>
<video controls="controls" id="container" poster="http://www.example.com/yourvideothumbs/videothumb.jpg" width="693" height="388">
<source src="http://www.example.com/videos/jourvideo.mp4" type="video/mp4" />
</video>
</center>
Javascript:
if(navigator.userAgent.toLowerCase().match(/(android)/) || navigator.userAgent.toLowerCase().match(/(chrom)/) ){
//wee must force flash video player in chrome, because mp4 video files is not supported yet in chrome's HTML5 video implementation.
modes = [{type: 'flash', src: '[JWPLAYERBASEDIR]/swf/player.swf'}];
}else{
modes = [ {type: 'html5'},{type: 'flash', src: '[JWPLAYERBASEDIR]swf/player.swf'}];
}
jwplayer("container").setup({
'modes':modes,
});
这在所有浏览器中都对我有用。jwplayer 可以符合 HTML5 是否支持。
或者下面的强制 HTML4 实现:
<div id="container"></div>
<script type="text/javascript">
jwplayer("container").setup({
modes = [{type: 'flash', src: '[JWPLAYERBASEDIR]/swf/player.swf'}], //force flashplayer for video
image: "yourvideothumbs/videothumb.jpg", //poster image
file: "videos/jourvideo.mp4", //video file
height: "693", //set height in px
width: "388" //set width in px
});
在设置中,您可以设置skin
任何controls
您autostart
想要的:
http ://www.longtailvideo.com/support/jw-player/28839/embedding-the-player/