mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 23:51:20 -08:00
移除大部分异步操作
This commit is contained in:
1 parent
3fb41eedf7
commit
450e4ac879
8 files changed
+82
-90
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { getExt } from '../utils';
|
||||
import { getExt, sleep } from '../utils';
|
||||
|
||||
export default function attachUrlMix(art, player) {
|
||||
const {
|
||||
@@ -15,15 +15,17 @@ export default function attachUrlMix(art, player) {
|
||||
value: url => {
|
||||
const typeName = type || getExt(url);
|
||||
const typeCallback = customType[typeName];
|
||||
if (typeName && typeCallback) {
|
||||
art.emit('beforeCustomType', typeName);
|
||||
typeCallback($video, player.returnUrl(url), art);
|
||||
art.emit('afterCustomType', typeName);
|
||||
} else {
|
||||
art.emit('beforeAttachUrl', url);
|
||||
$video.src = player.returnUrl(url);
|
||||
art.emit('afterAttachUrl', $video.src);
|
||||
}
|
||||
sleep().then(() => {
|
||||
if (typeName && typeCallback) {
|
||||
art.emit('beforeCustomType', typeName);
|
||||
typeCallback($video, player.returnUrl(url), art);
|
||||
art.emit('afterCustomType', typeName);
|
||||
} else {
|
||||
art.emit('beforeAttachUrl', url);
|
||||
$video.src = player.returnUrl(url);
|
||||
art.emit('afterAttachUrl', $video.src);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { clamp, sleep } from '../utils';
|
||||
import { clamp } from '../utils';
|
||||
|
||||
export default function attrInit(art, player) {
|
||||
const {
|
||||
@@ -25,7 +25,5 @@ export default function attrInit(art, player) {
|
||||
$video.autoplay = option.autoplay;
|
||||
}
|
||||
|
||||
sleep().then(() => {
|
||||
player.attachUrl(option.url);
|
||||
});
|
||||
player.attachUrl(option.url);
|
||||
}
|
||||
Reference in new issue
Block a user