cc.Class({
extends: cc.Component,
properties: {
videoplayer: cc.VideoPlayer
},
onLoad: function () {
console.log(this.videoplayer.node)
this.videoplayer.node.on('ready-to-play', this.callback, this);
//监听视频是否播放完毕,如果播放完毕再次播放
this.videoplayer.node.on('completed', this.callback1, this);
//视频的宽度高度自适应
let windowSize=cc.view.getVisibleSize();
cc.log("width="+windowSize.width+",height="+windowSize.height);
windowSize=cc.winSize;//推荐 原因 短
cc.log("width="+windowSize.width+",height="+windowSize.height)
console.log("orientation=",cc.view)
this.videoplayer.height=windowSize.height;
},
callback1: function (event) {
console.log('结束了')