feat(music): 添加自动解析 并修改获取url的逻辑

This commit is contained in:
alger
2023-12-20 15:53:33 +08:00
parent bb1b07e0b3
commit a1780bc9d4
5 changed files with 36 additions and 55 deletions
+13
View File
@@ -1,5 +1,6 @@
import { getMusicLrc } from '@/api/music'
import { ILyric } from '@/type/lyric'
import { getIsMc } from '@/utils'
import { ref } from 'vue'
interface ILrcData {
@@ -89,6 +90,17 @@ const setAudioTime = (index: any, audio: HTMLAudioElement) => {
audio.play()
}
const ProxyUrl =
import.meta.env.VITE_API_PROXY + '' || 'http://110.42.251.190:9856'
const getMusicProxyUrl = (url: string) => {
if (!getIsMc()) {
return url
}
const PUrl = url.split('').join('+')
return `${ProxyUrl}/mc?url=${PUrl}`
}
export {
lrcData,
lrcArray,
@@ -101,4 +113,5 @@ export {
setAudioTime,
nowTime,
allTime,
getMusicProxyUrl,
}