update ts

This commit is contained in:
Harvey committed 2021-12-01 14:16:43 +08:00
1 parent 7dfe78a95d
commit 69563e818b
10 files changed
+353 -120

No files matched your search

+1
View File
@@ -60,5 +60,6 @@ export default class Hotkey {
} else {
this.keys[key] = [event];
}
return this;
}
}
@@ -1,7 +1,7 @@
import { def } from '../utils';
export default function exclusiveInit(art, player) {
const sizeProps = ['mini', 'pip', 'fullscreen', 'fullscreenWeb', 'fullscreenRotate'];
const sizeProps = ['mini', 'pip', 'fullscreen', 'fullscreenWeb'];
function exclusive(props) {
props.forEach((name) => {
@@ -43,9 +43,10 @@ export default function screenshotMix(art, player) {
def(player, 'screenshot', {
value: () => {
player.getDataURL().then((dataUri) => {
return player.getDataURL().then((dataUri) => {
download(dataUri, `${option.title || 'artplayer'}_${secondToTime($video.currentTime)}.png`);
art.emit('screenshot', dataUri);
return dataUri;
});
},
});
+21 -18
View File
@@ -4,25 +4,28 @@ export default function switchMix(art, player) {
const { i18n, option, notice } = art;
function switchUrl(url, name, currentTime) {
if (url === player.url) return;
URL.revokeObjectURL(player.url);
const { playing } = player;
player.url = url;
art.once('video:canplay', () => {
player.playbackRate = false;
player.aspectRatio = false;
player.flip = 'normal';
player.autoSize = option.autoSize;
player.currentTime = currentTime;
art.notice.show = '';
if (playing) {
player.play();
}
if (name) {
notice.show = `${i18n.get('Switch video')}: ${name}`;
}
return new Promise((resolve) => {
if (url === player.url) return resolve(url);
URL.revokeObjectURL(player.url);
const { playing } = player;
player.url = url;
art.once('video:canplay', () => {
player.playbackRate = false;
player.aspectRatio = false;
player.flip = 'normal';
player.autoSize = option.autoSize;
player.currentTime = currentTime;
art.notice.show = '';
if (playing) {
player.play();
}
if (name) {
notice.show = `${i18n.get('Switch video')}: ${name}`;
}
art.emit('switch', url);
resolve(url);
});
});
art.emit('switch', url);
}
def(player, 'switchQuality', {
+2 -2
View File
@@ -4,9 +4,9 @@ export default function toggleMix(art, player) {
def(player, 'toggle', {
value() {
if (player.playing) {
player.pause();
return player.pause();
} else {
player.play();
return player.play();
}
},
});
@@ -84,6 +84,8 @@ export default class Component {
def(this, name, {
value: $ref,
});
return $ref;
}
selector(option, $ref) {