mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 16:11:20 -08:00
update artplayer.d.ts
This commit is contained in:
1 parent
71fad99a6a
commit
a3b767f15d
9 files changed
+36
-32
No files matched your search
@@ -29,7 +29,7 @@ export default function artplayerPluginDashQuality(option) {
|
||||
};
|
||||
|
||||
if (option.control) {
|
||||
art.controls.add({
|
||||
art.controls.update({
|
||||
name: 'dash-quality',
|
||||
position: 'right',
|
||||
html: defaultHtml,
|
||||
@@ -51,7 +51,7 @@ export default function artplayerPluginDashQuality(option) {
|
||||
}
|
||||
|
||||
if (option.setting) {
|
||||
art.setting.add({
|
||||
art.setting.update({
|
||||
name: 'dash-quality',
|
||||
tooltip: defaultHtml,
|
||||
html: title,
|
||||
@@ -75,6 +75,7 @@ export default function artplayerPluginDashQuality(option) {
|
||||
}
|
||||
|
||||
art.on('ready', update);
|
||||
art.on('restart', update);
|
||||
|
||||
return {
|
||||
name: 'artplayerPluginDashQuality',
|
||||
|
||||
@@ -15,7 +15,7 @@ export default function artplayerPluginHlsQuality(option) {
|
||||
const defaultHtml = defaultLevel ? getResolution(defaultLevel) : auto;
|
||||
|
||||
if (option.control) {
|
||||
art.controls.add({
|
||||
art.controls.update({
|
||||
name: 'hls-quality',
|
||||
position: 'right',
|
||||
html: defaultHtml,
|
||||
@@ -36,7 +36,7 @@ export default function artplayerPluginHlsQuality(option) {
|
||||
}
|
||||
|
||||
if (option.setting) {
|
||||
art.setting.add({
|
||||
art.setting.update({
|
||||
name: 'hls-quality',
|
||||
tooltip: defaultHtml,
|
||||
html: title,
|
||||
@@ -59,6 +59,7 @@ export default function artplayerPluginHlsQuality(option) {
|
||||
}
|
||||
|
||||
art.on('ready', update);
|
||||
art.on('restart', update);
|
||||
|
||||
return {
|
||||
name: 'artplayerPluginHlsQuality',
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ declare class Artplayer extends Player {
|
||||
|
||||
readonly setting: {
|
||||
option: Setting[];
|
||||
add(setting: Setting): SettingOption;
|
||||
add(setting: Setting): SettingOption[];
|
||||
update(settings: Setting[]): SettingOption[];
|
||||
updateStyle(width?: number): void;
|
||||
remove(): void;
|
||||
|
||||
Reference in new issue
Block a user