update artplayer.d.ts

This commit is contained in:
Harvey Zack committed 2023-04-21 22:55:16 +08:00
1 parent 71fad99a6a
commit a3b767f15d
9 files changed
+36 -32

No files matched your search

+11 -9
View File
@@ -8,28 +8,30 @@ export default function urlMix(art) {
def(art, 'url', {
get() {
return $video.currentSrc;
return $video.src;
},
async set(url) {
if (url) {
const oldUrl = art.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;
}
if (oldUrl !== art.url) {
art.option.url = url;
art.emit('url', url);
if (art.isReady && oldUrl) {
art.once('video:canplay', () => {
art.emit('restart', url);
});
}
}
} else {
await sleep();
+2 -3
View File
@@ -94,7 +94,7 @@ export default class Setting extends Component {
this.$parent.innerHTML = '';
}
update(settings = []) {
update(settings) {
this.remove();
this.events = [];
this.cache = new Map();
@@ -106,8 +106,7 @@ export default class Setting extends Component {
add(setting) {
this.option.push(setting);
this.update();
return setting;
return this.update(this.option);
}
creatHeader(item) {