mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-21 04:31:20 -08:00
32 lines
880 B
JavaScript
32 lines
880 B
JavaScript
import { getExt, def, sleep } from '../utils';
|
|
|
|
export default function urlMix(art, player) {
|
|
const {
|
|
option,
|
|
template: { $video },
|
|
} = art;
|
|
|
|
def(player, 'url', {
|
|
get() {
|
|
return $video.src;
|
|
},
|
|
set(url) {
|
|
const typeName = option.type || getExt(url);
|
|
const typeCallback = option.customType[typeName];
|
|
if (typeName && typeCallback) {
|
|
sleep().then(() => {
|
|
art.loading.show = true;
|
|
const result = typeCallback.call(art, $video, url, art);
|
|
def(art, typeName, {
|
|
value: result,
|
|
});
|
|
});
|
|
} else {
|
|
$video.src = url;
|
|
art.option.url = url;
|
|
art.emit('url', url);
|
|
}
|
|
},
|
|
});
|
|
}
|