Commit ec6dea3c authored by limingzhe's avatar limingzhe

fix: debug

parent 94b44dda
......@@ -236,11 +236,11 @@ cc.Class({
if(nextItem) {
// nextItem.emit('my_item_click');
this.clickVideoItem(null, nextItem);
this.clickVideoItem2(nextItem);
} else {
// this.videoItemList[0].emit('my_item_click');
this.clickVideoItem(null, this.videoItemList[0]);
this.clickVideoItem2(this.videoItemList[0]);
}
});
cc.view.setResizeCallback((params) => {
......@@ -387,6 +387,70 @@ cc.Class({
},
async clickVideoItem2(item) {
if (!item.video_url) {
this.showTips("视频不存在");
return;
}
// 先暂停当前视频并释放资源
if (this.videoPlayer.isPlaying()) {
this.videoPlayer.pause();
}
// 在切换URL前先将视频组件停止并清空
this.videoPlayer.stop();
this.videoPlayer.remoteURL = '';
// 给系统一点时间来释放资源
await asyncDelay(100);
if (item.video_url == this.videoPlayer.remoteURL) {
this.showTips("该视频正在播放");
return;
}
this.videoPlayIndex = item.playIndex;
this._isReadyToPlay = false;
cc.find(`Canvas/loading`).active = true;
cc.find(`Canvas/bg`).active = true;
cc.find(`Canvas/bgwhite`).active = true;
cc.find(`Canvas/bg_video_shadow`).active = true;
// this.videoPlayer.node.x = -5000;
// this.videoPlayer.node.y = -5000;
cc.find(`Canvas/videolist/view/content`).children.forEach(row => {
cc.find(`item_active`, row).active = false;
});
cc.find(`item_active`, item).active = true;
this.videoPlayer.remoteURL = item.video_url;
// 数据采集
for (let i = 0; i < this.data.dataArr.length; i++) {
const element = this.data.dataArr[i];
if (element.video_url == item.video_url) {
const count = this.data.dataArr[i].count;
if (count) {
this.data.dataArr[i].count ++;
} else {
this.data.dataArr[i].count = 1;
}
}
}
const totalCount = this.data.totalCount;
if (totalCount) {
this.data.totalCount ++;
} else {
this.data.totalCount = 1;
}
},
start() {
let getData = this.getData.bind(this);
if (window && window.courseware) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment