build all packages

This commit is contained in:
zhw2590582 committed 2019-04-21 11:57:44 +08:00
1 parent 9de6e12671
commit 3b172ffa93
31 files changed
+447 -58

No files matched your search

+4
View File
@@ -50,6 +50,10 @@ class Artplayer extends Emitter {
return utils;
}
static get scheme() {
return scheme;
}
static get Emitter() {
return Emitter;
}
@@ -18,9 +18,9 @@ export default function attachUrlMix(art, player) {
typeCallback.call(art, $video, videoUrl, art);
art.emit('afterCustomType', typeName);
} else {
art.emit('beforeAttachUrl');
art.emit('beforeAttachUrl', videoUrl);
$video.src = videoUrl;
art.emit('afterAttachUrl');
art.emit('afterAttachUrl', videoUrl);
}
return Promise.resolve(videoUrl);
}
+2 -2
View File
@@ -8,7 +8,7 @@ import seekMix from './seekMix';
import volumeMix from './volumeMix';
import currentTimeMix from './currentTimeMix';
import durationMix from './durationMix';
import switchQualityMix from './switchQualityMix';
import switchMix from './switchMix';
import playbackRateMix from './playbackRateMix';
import aspectRatioMix from './aspectRatioMix';
import screenshotMix from './screenshotMix';
@@ -33,7 +33,7 @@ export default class Player {
volumeMix(art, this);
currentTimeMix(art, this);
durationMix(art, this);
switchQualityMix(art, this);
switchMix(art, this);
playbackRateMix(art, this);
aspectRatioMix(art, this);
screenshotMix(art, this);
@@ -0,0 +1,43 @@
export default function switchMix(art, player) {
const { i18n, notice, option } = art;
Object.defineProperty(player, 'switchQuality', {
value: (url, name = 'unknown') => {
if (url !== option.url) {
const { currentTime, playing } = player;
return player.attachUrl(url).then(() => {
option.url = url;
player.playbackRateRemove();
player.aspectRatioRemove();
player.seek(currentTime);
if (playing) {
player.play();
}
notice.show(`${i18n.get('Switch video')}: ${name}`);
art.emit('switch', url);
});
}
return null;
},
});
Object.defineProperty(player, 'switchUrl', {
value: (url, name = 'unknown') => {
if (url !== option.url) {
const { playing } = player;
return player.attachUrl(url).then(() => {
option.url = url;
player.playbackRateRemove();
player.aspectRatioRemove();
player.seek(0);
if (playing) {
player.play();
}
notice.show(`${i18n.get('Switch video')}: ${name}`);
art.emit('switch', url);
});
}
return null;
},
});
}
@@ -1,26 +0,0 @@
export default function switchMix(art, player) {
const {
i18n,
notice,
option,
} = art;
Object.defineProperty(player, 'switchQuality', {
value: (url, name = 'unknown') => {
if (url !== option.url) {
const { currentTime, playing } = player;
player.attachUrl(url).then(() => {
option.url = url;
player.playbackRateRemove();
player.aspectRatioRemove();
player.seek(currentTime);
if (playing) {
player.play();
}
notice.show(`${i18n.get('Switch video')}: ${name}`);
art.emit('switch', url);
});
}
},
});
}