- Home /
Load songs from iOS Music Player?
Hello everyone,
I am aware that you can take files access and copy files from the iOS Library via Xcode/Obj-c, but I am wondering if there is a way for Unity to read the audio file? Lots of the audio files on the iOS Library are likely m4a, and I was wondering if it is at all possible for Unity to be able to read these files?
I know the audio files unity supports, and that m4a is no longer one of them. But I am wondering if there is any way to encode audio files that are copied from the library. I am aware of LAME and FFmpeg, but there are some problems with these. FFmpeg requires you to release your source code if you use it, and I also believe that I would not be able to submit my App if it includes those custom frameworks.
Is there absolutely any way that I would be able to read most audio files from the iOS Library, besides mp3? My game will likely depend on these files.
If I cannot use m4a, would you suggest me limiting my app to just mp3? This is really NOT what I want to do, but if there is no other way, it might necessary. The other option is to have the user upload the m4a to a server, which quickly encodes it, and sends it back. The problem with this solution is that it requires the user to have a internet connection, which is not ideal for many games.
Thanks for your time,
-Kyle
Answer by hunterleaman · Feb 22, 2015 at 04:05 PM
One possible alternative might be to convert the m4a to mp3 on unity's side but that would be pretty heavy. I published a package that accesses the music library, loads and controls playback of a song though, you can find it here http://partycircl.es/unity-assets/ios-music-library-access or on the asset store
Answer by Rouge Digital · Jul 03, 2016 at 09:45 PM
I maid an Asset play mp3 files, it works on Win, Max, Linux, iOS, android...
It works for local mp3 files and web streams, but could be upgraded to work against m4a or other formats.
I could or you could add a m4a file decoder to uAudio, it is just a custom audio parsing script.
I am currently adding .ogg decoding but I could be convinced to add m4a.
Asset - [uAudio: Mp3 Player/Streamer][1]