At the Unite 2008 presentation I asked a question regarding Unity iPhone and access to users’ mp3’s and digital images on the devise, and if it was possible, how.
The answer I got was a surprise and I just wanted to check I heard correctly, because it was an exciting morning and I may have just mis understood.
The answer was something along the lines of:
‘No! I can’t imagine users wanting to search through long lists of directories…’ and that it wasn’t a priority for Unity at this stage.
So incase I heard wrong can anyone confirm or deny this? Does Unity iPhone support use of users mp3 and digital images from the iPhone?
I can think of a lot of ways which these two capabilities would provide developers ways to allow user content in their software, which is becoming important in certain aspects of digital entertainment.
AFAIK, Apple will not allow apps to access the user’s music collection. In order to use your own music with existing iPhone games, you need to launch a playlist or song in the iPod app, then launch the game. The iPod app will continue to run in the background as long as the game doesn’t “take over” that audio channel. Sound effects can still run from within in the game, just not constant music. (Someone else can probably provide a more technical answer, but this is the gist of it).
Photo album access is allowed by Apple, and would be a great feature to see in future Unity iPhone updates. Many current games already take advantage of this now and it’s a real value-add IMO.
Lots of iPhone apps allow the user’s music to play in the background. You don’t initiate the music playing from in-game, but if you started it playing and THEN launch the game, many games allow it to continue playing while the game runs. It would seem, however, Unity does not allow this at the moment.
Right from the official APIs from Apple you’re not able to use in any form the iTunes library on the phone. Accessing the user’s mail settings is also not possible (ok, that’s for sure, no one wants iPhone spam machines :-)).
The jailbroke projects did a listing of the functions in the phone libraries that are not documented, so in case you know how, you could try to invoke these functions, BUT (!) I’m pretty sure the app is never allowed to get into the store if if no one at Apple notices while submitting, it might be pulled off at anytime without notice if using the undocumentated API calls.
So right now no official way to connect to the music lib, unfortunately.
That’s odd, since one of the most popular word games for iPhone is Wurdle which allows you to choose a picture from your collection as the background for the game.
Uaaaah, oh damn, I think I mixed up two things. Accessing the photo library IS of course available via code, but iTunes and email not. Bah! I’m sorry, will correct my posting above.
Came up like a flash when reading my own post. Sorry for confusion!
I know for a fact you can access the camera and photo library … you can also access the user’s contacts, I use it in one of my apps. You just cannot access things like the user’s iPod music library.
There’s no built-in support from Unity, but there is support with Apple’s own APIs. You’d have to write the Objective-C side yourself (and in the case of playing music, you’d have to make sure you don’t screw up Unity’s audio session). Note that I haven’t tried it myself, so I don’t know what the pitfalls are.
edit: Also, apparently the Prime31 guys have this working in one of their plugins already: http://prime31.com/unity/
Thanks. Yeah I’ve been looking at Prime’s plug in but not sure if it’s going to do what I need…I’ve asked them. It might be a feature I may have to drop.
Is it possible to grab the sound currently being played by the iPod with Unity? I’m talking about the sound data so I could, for example, do something with the waveform.
My game barnyard bounce checks for ipod music library playing and cancels its own music if so, and allows the user to play their own music. I think that Apple also allow this - but you need to do an apple call for it. There is an addon for it on these very forums somewhere to select music from the ipod library.
This is strictly a no-no from Apple, they will not accept your game if it contains any method to record music which is inside your ipod library.
However, samples you supply, or can record via the mic are allowed to be edited and recorded, its just the DRM for the itunes music you’re not allowed to record from.