简体   繁体   中英

iOS: audio MP3 file path

I am using Xamarin Forms to create my mobile application. I downloaded the XamarinAudioManager package to play the MP3 files and am using this line of code to set the path.

            Audio.Manager.SoundPath = "/Users/TaylorWong/Projects/test/test/Sounds";

The files play on the iPhone simulator on my computer, but not on my actual iPhone. I am having trouble with the audio file path. I don't think the files are being accessed even though I have them saved in the iOS Resources folder, within a Sounds folder, in Visual Studios as well as my computer. Any suggestion would be greatly appreciated!

I'm not sure how XamarinAudioManager works but I think You have to add the files to Resources folder and just set the name of the mp3 file, be sure that your files have the build action = bundle resources.

Audio.Manager.SoundPath = "YourFileName.mp3"

if you have sub-folder use like this

Audio.Manager.SoundPath = "subfolder/YourFileName.mp3"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM