mpmusicplayercontroller

Get album artwork from MP3 file/ID3 tag

为君一笑 提交于 2019-11-30 17:33:04
问题 I'm trying to get the album artwork from a MP3 file. In this case I use AVAudioPlayer to play the file. Here's the code that I thought would get the album artwork: MPMusicPlayerController *controller = [MPMusicPlayerController applicationMusicPlayer]; MPMediaItem *current = controller.nowPlayingItem; MPMediaItemArtwork *artwork = [current valueForProperty:MPMediaItemPropertyArtwork]; UIImage *artwork2 = [artwork imageWithSize:artwork.bounds.size]; [artworkView setImage:artwork2]; However

iOS AudioSessionSetActive() blocking main thread?

こ雲淡風輕ζ 提交于 2019-11-30 03:12:15
问题 in my iOS app, I'm trying to implement "ducking": while my app plays a short "command-like" sound, any background music should be lowered in volume. Having finished playing the sound, the music volume should go back to its original value. As implemented, ducking basically works as expected. However, when I call AudioSessionSetActive(NO) in audioPlayerDidFinishPlaying: in order to end ducking, there is a small pause in any UI updates that occur at this point of time. This involves custom

iOS: Displaying currently played track info in LockScreen?

不问归期 提交于 2019-11-29 04:34:11
As of iOS 5 we have access to MPNowPlayingInfoCenter to display info in the lockscreen and in the multimedia controls on the multitasking bar. I have an app that plays local audio files. I want to display info like the artist's name, the album and the artwork on the lockscreen with MPNowPlayingInfoCenter , but the only way to do this (As far as I know) is to use MPMusicPlayerController and get nowPlayingItem ... The problem is that MPMusicPlayerController is used to play iPod Music only, and not locally stored files. Is there a way around this in iOS 5? You can create your own NSDictionary and

How Do I Get Audio Controls on Lock Screen/Control Center from AVAudioPlayer in Swift

↘锁芯ラ 提交于 2019-11-28 20:36:08
New to iOS development, so here goes. I have an app that is playing audio - I'm using AVAudioPlayer to load single files by name in the app's assets. I don't want to query the user's library, only the files provided. Works great, but, I want the user to be able to pause and adjust volume from the lock screen. func initAudioPlayer(file:String, type:String){ let path = NSBundle.mainBundle().pathForResource(file, ofType: type)! let url = NSURL(fileURLWithPath: path) let audioShouldPlay = audioPlaying() do{ try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback) try

Iphone sdk support for playing mp3 files over the network

≯℡__Kan透↙ 提交于 2019-11-28 11:51:35
I am writing an application to contact a webserver running on a desktop to access and play mp3 files. Here is what I tried so far: I have used MPMusicPlayerController (and tried UIWebview) to handle the audio file and it automatically plays after progressively downloading the file. There is no way to handle skipping songs and playing after progressive download of a file is not a good solution for cellular network. Ideally, I would like to have the following function 1. Client requests a stream to be created using a specific bitrate (to handle different network condition) 2. Client should be

Iphone sdk support for playing mp3 files over the network

人盡茶涼 提交于 2019-11-27 19:21:36
问题 I am writing an application to contact a webserver running on a desktop to access and play mp3 files. Here is what I tried so far: I have used MPMusicPlayerController (and tried UIWebview) to handle the audio file and it automatically plays after progressively downloading the file. There is no way to handle skipping songs and playing after progressive download of a file is not a good solution for cellular network. Ideally, I would like to have the following function 1. Client requests a

How Do I Get Audio Controls on Lock Screen/Control Center from AVAudioPlayer in Swift

假如想象 提交于 2019-11-27 13:01:26
问题 New to iOS development, so here goes. I have an app that is playing audio - I'm using AVAudioPlayer to load single files by name in the app's assets. I don't want to query the user's library, only the files provided. Works great, but, I want the user to be able to pause and adjust volume from the lock screen. func initAudioPlayer(file:String, type:String){ let path = NSBundle.mainBundle().pathForResource(file, ofType: type)! let url = NSURL(fileURLWithPath: path) let audioShouldPlay =

applicationMusicPlayer volume notification

馋奶兔 提交于 2019-11-27 03:40:45
I am using an applicationMusicPlayer and when i try to change the volume appear the visual notification, as shown in the picture. Here the code I am using: [MPMusicPlayerController applicationMusicPlayer] setVolume:newVolune]; Anyone knows how to hide this notification? I don't know where the docs says so, but if you add a MPVolumeView view to your app the system volume overlay goes away. Even if it is not visible: - (void) viewDidLoad { [super viewDidLoad]; MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame: CGRectZero]; [self.view addSubview: volumeView]; [volumeView release]; ..

iOS 9: How to change volume programmatically without showing system sound bar popup?

[亡魂溺海] 提交于 2019-11-26 17:45:39
I have to change the volume on iPad and using this code: [[MPMusicPlayerController applicationMusicPlayer] setVolume:0]; But this changing volume and showing system volume bar on iPad. How to change the sound without showing the volume bar? I know, setVolume: is deprecated, and everybody says to use MPVolumeView . If this is the only way to solve my problem, then how to change the volume using MPVolumeView ? I don't see any method in MPVolumeView that changes the sound. Should I use some another class together with MPVolumeView ? But it's preferable to use MPMusicPlayerController . Thank you

iOS 7: MPMusicPlayerController volume deprecated. How to change device volume now?

你离开我真会死。 提交于 2019-11-26 15:54:08
MPMusicPlayerController setVolume is deprecated since iOS 7 Is there any other way to change system music volume? Preferably without user interaction. Its important feature: to increase volume automatically for any alarm clock from AppStore. To answer you question exactly: Yes there is other way to change system volume without user interaction. Until recent times I used to think that changing volume using MPVolumeView programmatically is possible only using private API . But I have just verified, that changing the value of volumeSlider and faking slider's touchUP event works: MPVolumeView*