增加播放方法的错误捕捉

This commit is contained in:
Harvey Zack committed 2018-11-01 10:59:39 +08:00
1 parent d7cb9d16b8
commit a7bebabb6d
3 files changed
+23 -20

No files matched your search

+12 -10
View File
@@ -1012,13 +1012,7 @@
_this.art.loading.hide();
if (option.autoplay) {
var promise = _this.play();
if (promise !== undefined) {
promise.then().catch(function (err) {
console.warn(err);
});
}
_this.play();
}
});
this.art.on('video:playing', function () {
@@ -1064,9 +1058,11 @@
_this.art.controls.hide();
$player.classList.add('artplayer-error');
notice.show(i18n.get('Video load failed'), false);
sleep(1000).then(function () {
notice.show(i18n.get('Video load failed'), false);
_this.art.destroy();
_this.art.destroy();
});
}
});
}
@@ -1078,9 +1074,15 @@
i18n = _this$art3.i18n,
notice = _this$art3.notice;
var promise = $video.play();
if (promise !== undefined) {
promise.then().catch(function (err) {
notice.show(err, true, 3000);
});
}
notice.show(i18n.get('Play'));
this.art.emit('play', $video);
return promise;
}
}, {
key: "pause",