Commit 5238f44f authored by liujiangnan's avatar liujiangnan

fix: 播放问题

parent 46cde08c
......@@ -51,9 +51,7 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
this.hasVideo = !!this.data.contentObj.video_url
window["air"].hideAirClassLoading(this.saveKey, this.data);
setTimeout(() => {
this.refresh();
}, 1000);
this.refresh();
}, this.saveKey);
}
......@@ -99,15 +97,30 @@ export class PlayComponent implements OnInit, OnDestroy, OnChanges, AfterViewIni
if (!this.videoNodeRef) {
return;
}
if (!this.player) {
this.ngAfterViewInit();
}
if (!this.player) {
return;
}
this.initCover = false;
if (this.player.paused) {
this.player.play();
this.isPlayStarted = true;
const playPromise = this.player.play();
if (playPromise !== undefined) {
playPromise.then(_ => {
this.isPlayStarted = true;
})
.catch(error => {
console.log('error', error);
});
}
} else {
this.player.pause();
}
this.refresh();
}
onTimeUpdate(event) {
const player = event.target;
this.currentTime = player.currentTime;
......
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