Menu
  • HOME
  • TAGS

Play music through ear speaker from user library

ios,swift,audio,mpmusicplayercontroller,mpmediaitemcollection

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.

Get list of albums from ipod library in swift

ios,swift,mpmediaitem,mpmediaquery,mpmediaitemcollection

MPMediaItem has valueForProperty() function. The properties which you need are MPMediaItemPropertyAlbumTitle and MPMediaItemPropertyArtwork.

Skip to Previous and Next song notification in MPMusicplayercontroller?

ios,notifications,music-player,mpmusicplayercontroller,mpmediaitemcollection

I was using single media to play the song, I changed it to MPMediaCollection to play the songs in queue and which handles playing next and previous songs.

Play items from MPMediaItemCollection in AVPlayer [Swift]

swift,avplayer,mpmediaitemcollection

Here is your swift code: func mediaPicker(mediaPicker: MPMediaPickerController!, didPickMediaItems mediaItemCollection: MPMediaItemCollection!) { for thisItem in mediaItemCollection.items as! [MPMediaItem] { let itemUrl = thisItem.valueForProperty(MPMediaItemPropertyAssetURL) as? NSURL self.dismissViewControllerAnimated(true, completion: nil) // Play the item using MPMusicPlayer var appMusicPlayer = MPMusicPlayerController.applicationMusicPlayer() appMusicPlayer.play() // Play the item using AVPlayer let playerItem = AVPlayerItem(URL: itemUrl)...

How to retrieve data from NSUserDefaults?

ios,swift,audio,nsuserdefaults,mpmediaitemcollection

Here is the issue var currentQueue: MPMediaItemCollection = MPMediaItemCollection() You must init with items As per the documentation by apple. init(items:) Designated Initializer Initializes a media item collection with an array of media items. Declaration Swift init!(items items: [AnyObject]!) Parameters items The array of items you are assigning to the...

Play Song at specific index of MPMediaItemCollection in Swift

ios,swift,mpmediaplayercontroller,mpmediaitemcollection

According to the documentation, we use the nowPlayingItem property. To specify that playback should begin at a particular media item in the playback queue, set this property to that item while the music player is stopped or paused. So, it sounds like you should stop or pause the player, set...