use promise and object.assign polyfill

This commit is contained in:
DIYgod
2018-01-19 01:52:04 +08:00
parent cda90989b2
commit e26f78eed2
6 changed files with 20 additions and 15 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
/* global DPLAYER_VERSION GIT_HASH */
import objectAssign from 'object-assign';
import defaultApiBackend from './api.js';
export default (options) => {
@@ -116,7 +117,7 @@ export default (options) => {
}
if (options.icons) {
options.icons = Object.assign({}, defaultOption.icons, options.icons);
options.icons = objectAssign({}, defaultOption.icons, options.icons);
}
options.contextmenu = options.contextmenu.concat([
+7 -9
View File
@@ -1,3 +1,5 @@
import Promise from 'promise-polyfill';
import utils from './utils';
import handleOption from './options';
import i18n from './i18n';
@@ -175,15 +177,11 @@ class DPlayer {
this.template.playButton.innerHTML = this.icons.get('pause');
const playedPromise = this.video.play();
if (playedPromise) {
playedPromise.
catch(() => {
this.pause();
}).
then(() => {
});
}
const playedPromise = Promise.resolve(this.video.play());
playedPromise.catch(() => {
this.pause();
}).then(() => {
});
this.time.enable();
this.container.classList.add('dplayer-playing');
if (this.danmaku) {