Change quality order and default quality
This commit is contained in:
@ -89,6 +89,7 @@ onBeforeUnmount(() => {
|
|||||||
|
|
||||||
watch([instance, () => props.urls], async ([artplayer, urls]) => {
|
watch([instance, () => props.urls], async ([artplayer, urls]) => {
|
||||||
if (!artplayer) return;
|
if (!artplayer) return;
|
||||||
|
urls = urls.reverse()
|
||||||
artplayer.quality = urls;
|
artplayer.quality = urls;
|
||||||
artplayer.switch = urls[0].url;
|
artplayer.switch = urls[0].url;
|
||||||
instance.value = artplayer;
|
instance.value = artplayer;
|
||||||
|
@ -55,11 +55,13 @@ watchEffect(async () => {
|
|||||||
results.value = response?.data || null
|
results.value = response?.data || null
|
||||||
|
|
||||||
if (results.value?.links) {
|
if (results.value?.links) {
|
||||||
hlsUrls.value = Object.entries(results.value.links).map(([quality, links], index) => {
|
console.log(results.value.links)
|
||||||
|
hlsUrls.value = Object.entries(results.value.links).map(([quality, links], index, arr) => {
|
||||||
|
const isLatest = index === arr.length - 1
|
||||||
return {
|
return {
|
||||||
html: quality,
|
html: quality,
|
||||||
url: links.find(link => link.src?.includes('.m3u8') || link.type?.includes('hls'))?.src,
|
url: links.find(link => link.src?.includes('.m3u8') || link.type?.includes('hls'))?.src,
|
||||||
default: index === 0
|
default: isLatest
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user