对m4a类型加载完才播放

This commit is contained in:
2023-10-08 00:17:28 +08:00
parent 06e3d31883
commit dc34eeda6e
2 changed files with 5 additions and 4 deletions

View File

@ -215,7 +215,7 @@ export default class ClientList {
},
children: [
Avatar({
src: item.avatar || '/favicon.ico',
src: item.avatar ?? '/favicon.ico',
style: {
width: '32px',
height: '32px',
@ -230,7 +230,7 @@ export default class ClientList {
onclick: event => document.body.appendChild(Dialog({
children: [
Avatar({
src: item.avatar || '/favicon.ico',
src: item.avatar ?? '/favicon.ico',
style: {
width: '240px',
height: '240px',

View File

@ -140,8 +140,9 @@ export default class MusicList {
}
async play(item) {
if (!item.arrayBuffer) {
// 不支持流式加载wav和flac, 需要全部加载完毕才能播放
if (item.type === 'audio/wav' || item.type === 'audio/flac') {
console.log('加载音乐类型:', item.type)
// 不支持流式加载wav和flac和m4a, 需要全部加载完毕才能播放
if (item.type === 'audio/wav' || item.type === 'audio/flac' || item.type === 'audio/x-m4a') {
await this.load(item)
this.audio.src = URL.createObjectURL(new Blob([item.arrayBuffer], { type: item.type }))
this.audio.play()