update urlMix

This commit is contained in:
Harvey committed 2022-06-27 10:37:13 +08:00
1 parent 19d9e5cea9
commit bff84f9cb6
4 files changed
+42 -29

No files matched your search

+21 -16
View File
@@ -11,24 +11,29 @@ export default function urlMix(art) {
return $video.currentSrc;
},
async set(url) {
const typeName = option.type || getExt(url);
const typeCallback = option.customType[typeName];
if (typeName && typeCallback) {
if (url) {
const typeName = option.type || getExt(url);
const typeCallback = option.customType[typeName];
if (typeName && typeCallback) {
await sleep();
art.loading.show = true;
typeCallback.call(art, $video, url, art);
} else {
if (art.url && art.url !== url) {
art.once('video:canplay', () => {
if (art.isReady) {
art.emit('restart');
}
});
}
$video.src = url;
art.option.url = url;
art.emit('url', url);
}
} else {
await sleep();
art.loading.show = true;
typeCallback.call(art, $video, url, art);
} else {
if (art.url && art.url !== url) {
art.once('video:canplay', () => {
if (art.isReady) {
art.emit('restart');
}
});
}
$video.src = url;
art.option.url = url;
art.emit('url', url);
}
},
});