- <html>
- <head>
- <script type="text/javascript" src="/static/jwplayer.js"></script>
- </head>
- <body>
- <div id="container">Loading the player ...</div>
- <script type="text/javascript">
- jwplayer("container").setup({
- flashplayer: "/static/player.swf",
- file: "/static/video.mp4",
- height: 622,
- width:1104,
- stretching : 'fill',
- streamer:"start",
- provider:"http",
- modes :[
- {type:"html5"}
- ]
- });
- </script>
- </body>
- </html>
- modes: [
- { type: "html5" },
- { type: "flash", src: "/static/player.swf" },
- { type: "download" }
- ]
//页面加载的时候预加载第一个视频文件
function startPlayVideo(videoUrl, width, height){
var thePlayer;
if(IsPC()){
thePlayer = jwplayer('flashplayer').setup({
flashplayer:'http://'+window.location.host+'/flash/jwplayer/jwplayer.flash.swf',
//file: 'http://192.168.1.10:8080/'+$('#videourl').val(),
file: 'rtmp://...:8080/vod/mp4:'+videoUrl,
autostart: true, //开启自动播放
bufferlength: 180, //缓存时间为三分钟
smoothing: true, //开启平滑处理
showvolume:true, //显示音量控制按钮
width: width,
height: height,
dock: false
});
}else{
thePlayer = jwplayer('flashplayer').setup({
//flashplayer: 'http://'+window.location.host+'/flash/jwplayer/jwplayer.flash.swf',
file: "http://.../videos/"+videoUrl,
autostart: true, //开启自动播放
bufferlength: 180, //缓存时间为三分钟
smoothing: true, //开启平滑处理
showvolume:true, //显示音量控制按钮
width: width,
height: height,
dock: false,
modes: [
{type:"html5"}
]
});
}
var timer = setTimeout(function() {
thePlayer.play(false);
}, 500);
timer = null;
}
//判断是否是PC端
function IsPC()
{
var userAgentInfo = navigator.userAgent;
var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");
var flag = true;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }
}
return flag;
}