feat: 支持 UNM rust

This commit is contained in:
qier222 2022-05-01 19:53:25 +08:00
parent 4d59401549
commit 4d54060a4f
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
29 changed files with 717 additions and 231 deletions

View file

@ -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)
}