0

I'm making an app that allows the user to choose a music from his/her library and play it through the ear speaker. I got everything working, but this. I don't know how to play this audio through the ear speaker. The code I'm using to lay the audio is:

let player: MPMusicPlayerController! = MPMusicPlayerController.iPodMusicPlayer()
var mediaCollection: MPMediaItemCollection!

mediaCollection = mediaItemCollection
player.setQueueWithItemCollection(mediaCollection)

player.play()

If someone can help me it would be awesome, thanks in advance

Edit: From what I've seen, this class MpMusicPlayerController is independent from my app, so it will ignore any instructions, right? So probably I can't play through the ear speaker with this class. Does anyone know how to play a library music through the ear speaker?

4

1 回答 1

0

You can use an AVAudioSession to set the output to the ear speaker, but you would not be able to use MPMusicPlayerController to do it. See AVAudioSession manipulate sound output.

于 2015-04-26T23:02:44.903 回答