avaudioplayer

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

How do I get my sound to play when a remote notification is received?

与世无争的帅哥 提交于 2019-11-30 17:29:31
问题 I'm trying to automatically play a sound file (that is not part of my app bundle and is not a notification sound) upon receiving a remote notification. I want this to happen whether the app is in the foreground or background when the notification is received. I'm using the Amazing Audio Engine as a wrapper around the core audio libraries. In my App Delegate's didReceiveRemoteNotification I create an Audio Controller and add AEAudioFilePlayer to it like so: NSURL *file = [NSURL fileURLWithPath

AudioToolBox leak in iOS6?

喜你入骨 提交于 2019-11-30 17:20:28
问题 When I use AudioToolBox for playing music, memory leaks heavily. AVAudioPlayer *newMusicPlayer = [[AVAudioPlayer alloc] initWithData:data error:&error]; I use this code to play music. In iOS5 and iOS4, it works properly. But in iOS6, if data's size is 5M, all of the 5M leaked. And I can't see leak info in Instruments. Is there anybody have the same problem? Any suggestion will be grateful. All my audio code here(Using ARC): @implementation ViewController { AVAudioPlayer *_player; } - (void

How to do screen mirroring using AirPlay from the application (not from control panel) in iOS?

穿精又带淫゛_ 提交于 2019-11-30 16:41:10
问题 I am using MPVolumeView to show AirPlay button. I need to show a custom wallpaper to Apple TV through mirroring with audio. Audio is playing properly on Apple TV but wallpaper image is not showing. I am using AVAudioController for playing audio. I have checked YouTube application in which screen mirroring is working from application for video playing. Is it possible to screen mirroring within the app using AVAudioController ? Help me to solve this issue. Thanks in advance. 回答1: Unfortunately,

AVAudioPlayer is not playing in Background when iPhone is locked

女生的网名这么多〃 提交于 2019-11-30 16:22:06
Actually i fetching the songs from Documents Directory . I referred this Link:- http://www.raywenderlich.com/29948/backgrounding-for-ios , But it will play the songs from bundle only. but i want to play the songs from documents Directory. I tried Background modes in the Plist Application Does not in background = No in Plist In Appdelegate didFinishLaunchingWithOptions:- NSError *setCategoryErr = nil; NSError *activationErr = nil; [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error:&setCategoryErr]; [[AVAudioSession sharedInstance] setActive:YES error:

How can you play a sound of a specified duration using AVAudioPlayer on iOS?

送分小仙女□ 提交于 2019-11-30 16:14:14
问题 I want to play a specified duration within a sound file on IOS. I found a method in AVAudioPlayer that seeks to the begining of the playing (playAtTime:) but i cannot find a direct way to specify an end time before the end of the sound file. Is there is a way to achieve this? 回答1: If you don't need much precision and you want to stick with AVAudioPlayer , this is one option: - (void)playAtTime:(NSTimeInterval)time withDuration:(NSTimeInterval)duration { NSTimeInterval shortStartDelay = 0.01;

How to build a Workout app on WatchOS with audio feedback?

会有一股神秘感。 提交于 2019-11-30 15:31:21
问题 I am building a very simple workout app on WatchOS: One of it functions is to give audio feedback during the training. I am able to play a file when the display is on, but when the display is dark, the watch doesnt play my file. Can some one look over my swift code and help my figuring out what I am missing? Here is my extensionDelegate.swift: var audioPlayer = AVAudioPlayer() class ExtensionDelegate: NSObject, WKExtensionDelegate { func applicationDidFinishLaunching() { let audioSession =

Trying to fix AVAudioPlayer lag on its initial use

核能气质少年 提交于 2019-11-30 15:22:02
This issue has shown up in several other question here on SO: Slow start for AVAudioPlayer the first time a sound is played Delay in playing sounds using AVAudioPlayer I've tried implementing the fixes suggested but none of them are solving my problem. My application presents the user with a grid of objects to touch, when an object is touched a sound is played. This works great except on the initial touch there is a delay of ~2 seconds. To get around this I initialize my audio player with a dummy aiff file: - (void)viewDidLoad{ NSString *soundFile = [Card loadCardSoundPath:@"dummy"];

iOS - Playback of recorded audio fails with OSStatus error -43 (file not found)

泄露秘密 提交于 2019-11-30 15:14:40
I set up an AVAudioRecorder instance the following way when my view loads: AVAudioSession *audioSession = [AVAudioSession sharedInstance]; audioSession.delegate = self; [audioSession setActive:YES error:nil]; [audioSession setCategory:AVAudioSessionCategoryRecord error:nil]; NSString *tempDir = NSTemporaryDirectory(); NSString *soundFilePath = [tempDir stringByAppendingPathComponent:@"sound.m4a"]; NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath]; NSLog(@"%@", soundFileURL); NSDictionary *recordSettings = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt

AVAudioPlayer and AirPlay - possible?

折月煮酒 提交于 2019-11-30 15:09:24
I'm trying to ascertain whether it's possible to toggle AirPlay support using the AVAudioPlayer class. From what I have read: AirPlay is a technology that lets your application stream audio to Apple TV and to third-party AirPlay speakers and receivers. AirPlay support is built in to the AV Foundation framework and the Core Audio family of frameworks. Any audio content you play using these frameworks is automatically made eligible for AirPlay distribution. Once the user chooses to play your audio using AirPlay, it is routed automatically by the system. [ Ref ] Based on this info; it should work