Change quality order and default quality

This commit is contained in:
2025-08-28 17:50:11 +05:00
parent 030fde7348
commit 1e604922b9
2 changed files with 5 additions and 2 deletions

View File

@ -89,6 +89,7 @@ onBeforeUnmount(() => {
watch([instance, () => props.urls], async ([artplayer, urls]) => {
if (!artplayer) return;
urls = urls.reverse()
artplayer.quality = urls;
artplayer.switch = urls[0].url;
instance.value = artplayer;

View File

@ -55,11 +55,13 @@ watchEffect(async () => {
results.value = response?.data || null
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 {
html: quality,
url: links.find(link => link.src?.includes('.m3u8') || link.type?.includes('hls'))?.src,
default: index === 0
default: isLatest
}
})