mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 21:58:03 +00:00
feat: 支持 UNM rust
This commit is contained in:
parent
4d59401549
commit
4d54060a4f
29 changed files with 717 additions and 231 deletions
|
|
@ -224,15 +224,19 @@ export class Player {
|
|||
}
|
||||
if (this.trackID !== id) return
|
||||
Howler.unload()
|
||||
const url = audio.includes('?')
|
||||
? `${audio}&ypm-id=${id}`
|
||||
: `${audio}?ypm-id=${id}`
|
||||
const howler = new Howl({
|
||||
src: [`${audio}?id=${id}`],
|
||||
format: ['mp3', 'flac'],
|
||||
src: [url],
|
||||
format: ['mp3', 'flac', 'webm'],
|
||||
html5: true,
|
||||
autoplay,
|
||||
volume: 1,
|
||||
onend: () => this._howlerOnEndCallback(),
|
||||
})
|
||||
_howler = howler
|
||||
window.howler = howler
|
||||
if (autoplay) {
|
||||
this.play()
|
||||
this.state = State.Playing
|
||||
|
|
@ -257,7 +261,7 @@ export class Player {
|
|||
|
||||
private _cacheAudio(audio: string) {
|
||||
if (audio.includes('yesplaymusic')) return
|
||||
const id = Number(audio.split('?id=')[1])
|
||||
const id = Number(new URL(audio).searchParams.get('ypm-id'))
|
||||
if (isNaN(id) || !id) return
|
||||
cacheAudio(id, audio)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue