这里记录一个视频播放器,免费可适当修改;名称:ckplayer视频播放器(免费)
官网地址:http://www.ckplayer.com/
下载地址:http://www.ckplayer.com/down/
官网有详细的软件说明。
示例:
Body 代码
<div id="video_container"></div>
<script type="text/javascript" src="ckplayer/ckplayer.js" charset="utf-8"></script>
脚本部分:
<script type="text/javascript">
var source_array = ["/videos/01.mp4",
"/videos/02.mp4"];
var i = 0;
var ck;
var videoid = 'video'
function playVideo() {
var length = source_array.length;
if (i >= length) { i = 0; }
var videosrc = source_array[i]
console.log(videosrc);
var flashvars = {
f: videosrc,
c: 0,
b: 1,
p:1,
// i: 'images/default_img.jpg',
loaded: 'loadedHandler'
};
var video = [videosrc+'->video/mp4'];
ck= CKobject.embed('ckplayer/ckplayer.swf', 'video_contailer', 'ckplayer_a1', '600', '400', true, flashvars, video);
i++;
}
playVideo(); function loadedHandler() {
if (CKobject.getObjectById('ckplayer_a1').getType()) {
console.log('播放器已加载,调用的是HTML5播放模块');
CKobject.getObjectById('ckplayer_a1').addListener('ended', playHandler);
}
else {
console.log('播放器已加载,调用的是Flash播放模块');
CKobject.getObjectById("ckplayer_a1").addListener('ended', 'playHandler');
}
} function pauseHandler() {
//没有任何参数,但运行到这里则确认视频已暂停
}
function playHandler(){
// trace("播放了");
//删除监听
// console.log("播放了");
playVideo();
// ck.removeListener("demo.swf","play",playHandler);
} </script>