mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-13 07:46:17 -08:00
增加播放方法的错误捕捉
This commit is contained in:
1 parent
d7cb9d16b8
commit
a7bebabb6d
3 files changed
+23
-20
No files matched your search
+12
-10
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user