天道酬勤,学无止境

mpmusicplayercontroller

iOS 9.3.2 Breaks MPMusicPlayerController

问题 我正在尝试将 Apple Music 集成到我的应用程序中,直到今天早上我才设法让它完美运行。 更新到 iOS 9.3.2 后,一切都不一样了: 权限系统的工作方式相同(SKCloudServiceController)来检索用户的 AuthorizationStatus 和 Capability。 但是,MPMusicPlayerController 在使用新的 iOS 版本时表现不一样,让我解释一下: 在 iOS 9.3.1 上,如果我在 playerController.setQueueWithStoreIDs(:_) 中设置我的曲目后调用 playerController.play() 方法,我会立即收到带有 playerController.indexOfNowPlayingItem 等于0的MPMusicPlayerControllerNowPlayingItemDidChangeNotification并且音乐正在正常播放。 在 iOS 9.3.2 上,如果我在 playerController.setQueueWithStoreIDs(:_) 中设置曲目后调用 playerController.play() 方法,我会立即收到 MPMusicPlayerControllerNowPlayingItemDidChangeNotification ,其中

2022-04-25 10:19:23    分类:技术分享    ios   swift   mpmusicplayercontroller   apple-music

I need to know how to get information about which player is currently streaming (player, spotify, napster...)

问题 我可以获得当前正在播放的歌曲的信息(艺术家、专辑、标题): let t = MPMusicPlayerController().nowPlayingItem?.title 当音乐从 iOS 音乐播放器流式传输时,它工作正常。 但是,当流媒体来自其他来源(Spotify、Napster、Youtube、Tuneinradio 等)时,我无法获取信息。 如何获取任何应用程序的此信息? 回答1 在MPNowPlayingInfoCenter.defaultCenter()上使用nowPlayingInfo字典: let t = MPNowPlayingInfoCenter.defaultCenter().nowPlayingInfo[MPMediaItemPropertyTitle] MPNowPlayingInfoCenter类参考这里。

2022-04-22 22:19:25    分类:技术分享    ios   swift   spotify   mpmusicplayercontroller

Using MPMusicPlayerController, setting musicPlayer.currentPlaybackTime to seek but takes second to take effect

I have a UISlider acting as the scrubber. As the thumb is dragged I execute the following: - (void) _seekTo:(double)playbackTime { mPlayer.currentPlaybackTime = playbackTime; } That works fine, music seeks forward. Upon releasing the thumb, I restart the NSTimer to send time updates to keep the UISlider in synch. Problem is, upon releasing the thumb, the first few call backs contain the previous time value. This causes the thumb to jump back to its original position before returning to the new value. Very unsightly. Anyone have any experience with this behavior and a way to rectify? I can

2022-04-05 01:27:27    分类:问答    iphone   seek   mpmusicplayercontroller

iOS 9.3.2 Breaks MPMusicPlayerController

I'm trying to integrate Apple Music to my app, I managed to get it working flawlessly until this morning. After updating to iOS 9.3.2 nothing is the same: The permission system works the same (SKCloudServiceController) to retrieve the AuthorizationStatus and Capability of the user. However, the MPMusicPlayerController do not behave the same using the new iOS version, let me explain : On iOS 9.3.1, if I call the playerController.play() method after setting my tracks in playerController.setQueueWithStoreIDs(:_), I immediately receive the MPMusicPlayerControllerNowPlayingItemDidChangeNotification

2022-04-04 09:02:36    分类:问答    ios   swift   mpmusicplayercontroller   apple-music

Independent Volume control of AVAudioPlayer and MPMusicPlayerController in iOS App.

Within my application, I am playing downloaded audio using an AVAudioPlayer, while simultaneously playing audio from the user's iPod music library with an MPMusicPlayerController. I need to be able to adjust the Volume of the AVAudioPlayer instance so that it's louder than the audio coming from the MPMusicPlayerController. The problem is, when I adjust the Volume property of the AVAudioPlayer, it also adjusts the volume of the MPMusicPlayerController. Is there any solution which would allow me to independently control the volume of these two players? If not, is there another technique I should

2022-04-03 21:34:47    分类:问答    ios   cocoa-touch   avaudioplayer   mpmusicplayercontroller

Is it posible to play iPod songs using AVAudioPlayer?

I have a question that, Is it possible to get and play the iPod library songs / playlist using AVAudioPlayer instead of using MPMusicPlayer? Thanks in advance, Chandra.

2022-03-23 16:32:15    分类:问答    ios4   avaudioplayer   mpmusicplayercontroller

I need to know how to get information about which player is currently streaming (player, spotify, napster...)

I can get information (artist, album, title) of the song that is currently playing with: let t = MPMusicPlayerController().nowPlayingItem?.title It works fine when the music is streaming from the iOS Music Player. However, when the streaming is from other source (Spotify, Napster, Youtube, Tuneinradio, etc.) I can not get information. How can I get this information for any app?

2022-03-22 13:26:36    分类:问答    ios   swift   spotify   mpmusicplayercontroller

Problems with currentPlaybackTime and MPMusicPlayerController and iOS 7.1

Having problems setting currentPlaybackTime with MPMusicPlayerController in iOS 7.1. I used to be able to simply do the following: MPMusicPlayerController *iPodController = [MPMusicPlayerController applicationMusicPlayer]; iPodController.currentPlaybackTime = 30.0; [iPodController play]; And the music player would seek to 30 seconds in and play. As of iOS 7.1 this is not the case. If I do the following: [iPodController play]; iPodController.currentPlaybackTime = 30.0; Then it "may" jump 30 secs in or not. Very inconsistent. This used to work for all previous iOS versions. Is there a way to fix

2022-03-16 08:38:50    分类:问答    ios   iphone   audio   ios7.1   mpmusicplayercontroller