var player;
var num = 0;
var newUrl = "/VideoRes/01.mp4";
function endedHandle() {
++num;
console.log(num);
switch (num) {
case 1:
newUrl = "/VideoRes/02.mp4";
break;
case 2:
newUrl = "/VideoRes/03.mp4";
break;
case 3:
newUrl = "/VideoRes/04.mp4";
break;
case 4:
newUrl = "/VideoRes/01.mp4";
num = 0;
break;
}
player.dispose(); //销毁
$('#teachPlayer').empty(); //id为html里指定的播放器的容器id
//重新创建
player =new Aliplayer({
"id": "teachPlayer",
"source": newUrl,
"width": "648px",
"height": "358px",
"autoplay": true,
"cover": "/before/img/testPage/videopic.png",
"isLive": false,
"rePlay": false,
"playsinline": true,
"preload": true,
"controlBarVisibility": "hover",
"useH5Prism": true,
"skinLayout": [
{
"name": "bigPlayButton",
"align": "blabs",
"x": 30,
"y": 30
},
{
"name": "H5Loading",
"align": "cc"
},
{
"name": "errorDisplay",
"align": "tlabs",
"x": 0,
"y": 0
},
{
"name": "infoDisplay"
},
{
"name": "tooltip",
"align": "blabs",
"x": 0,
"y": 56
},
{
"name": "thumbnail"
},
{
"name": "controlBar",
"align": "blabs",
"x": 0,
"y": 0,
"children": [
{
"name": "progress",
"align": "blabs",
"x": 0,
"y": 44
},
{
"name": "playButton",
"align": "tl",
"x": 15,
"y": 12
},
{
"name": "timeDisplay",
"align": "tl",
"x": 10,
"y": 7
},
{
"name": "fullScreenButton",
"align": "tr",
"x": 10,
"y": 12
},
{
"name": "setting",
"align": "tr",
"x": 15,
"y": 12
},
{
"name": "volume",
"align": "tr",
"x": 5,
"y": 10
}
]
}
]
}, function (player) { }
);
player.on("ended", endedHandle);
}
player = new Aliplayer({
"id": "teachPlayer",
"source": newUrl,
"width": "648px",
"height": "358px",
"autoplay": false,
"cover": "/before/img/testPage/videopic.png",
"isLive": false,
"rePlay": false,
"playsinline": true,
"preload": true,
"controlBarVisibility": "hover",
"useH5Prism": true,
"skinLayout": [
{
"name": "bigPlayButton",
"align": "blabs",
"x": 30,
"y": 30
},
{
"name": "H5Loading",
"align": "cc"
},
{
"name": "errorDisplay",
"align": "tlabs",
"x": 0,
"y": 0
},
{
"name": "infoDisplay"
},
{
"name": "tooltip",
"align": "blabs",
"x": 0,
"y": 56
},
{
"name": "thumbnail"
},
{
"name": "controlBar",
"align": "blabs",
"x": 0,
"y": 0,
"children": [
{
"name": "progress",
"align": "blabs",
"x": 0,
"y": 44
},
{
"name": "playButton",
"align": "tl",
"x": 15,
"y": 12
},
{
"name": "timeDisplay",
"align": "tl",
"x": 10,
"y": 7
},
{
"name": "fullScreenButton",
"align": "tr",
"x": 10,
"y": 12
},
{
"name": "setting",
"align": "tr",
"x": 15,
"y": 12
},
{
"name": "volume",
"align": "tr",
"x": 5,
"y": 10
}
]
}
]
}, function (player) { }
);
player.on("ended", endedHandle);