HarmonyOS 鸿蒙Next如何播放本地mp3文件
playSound() { //创建soundPool实例 let soundPool: media.SoundPool; let audioRendererInfo: audio.AudioRendererInfo = { usage: audio.StreamUsage.STREAM_USAGE_MUSIC, rendererFlags: 1 } media.createSoundPool(5, audioRendererInfo, (error: BusinessError, soundPool_: media.SoundPool) => { if (error) { console.log(‘zd----’, Failed to createSoundPool) return; } else { soundPool = soundPool_; console.log(‘zd----’, Succeeded in createSoundPool) let file: fileIo.File; let soundID: number = 0; let fileSize: number = 1; //通过fileIo.stat()获取size值 let uri: string = “”; //获取fd的描述信息 fileIo.open(’…/…/resources/rawfile/kazicui.mp3’, fileIo.OpenMode.READ_ONLY).then((file_: fileIo.File) => { file = file_; console.log(‘zd----’, "file fd: " + file.fd); uri = ‘fd://’ + (file.fd).toString() soundPool.load(file.fd, 0, fileSize).then((soundId: number) => { console.log(‘zd----’, ‘Succeeded in loading soundpool’); soundID = soundId; }, (err: BusinessError) => { console.log(‘zd----’, 'Failed to load soundpool and catch error is ’ + err.message); }); }).catch((e: BusinessError) => { console.log(‘zd----’, ‘Failed to load soundpool and catch error is ’ + e.message + ’ code:’ + e.code); }); } }); } 提示Failed to load soundpool and catch error is No such file or directory code:13900002 音频文件要放在哪里