avaudioplayer

How to play an audio if we pass NSData?

℡╲_俬逩灬. 提交于 2019-12-04 01:24:49
问题 I converted this path (file://localhost/var/mobile/Applications/8F81BA4C-7C6F-4496-BDA7-30C45478D758/Documents/sound.wav) which is an audio file i.e, recorded. I am converting this path to NSData. NSData is : Example : <00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 64617461 1cf50200 32003200 e2ffe2ff 3cff3cff 08fe08fe 44fe44fe 04fe04fe e6fde6fd 95fd95fd 96fe96fe

AVAudioEngine crashes when I unplug headphones during a call

蓝咒 提交于 2019-12-04 00:13:49
Here is what I see in the log: 16:33:20.236: Call is Dialing 16:33:21.088: AVAudioSessionInterruptionNotification 16:33:21.450: AVAudioSessionRouteChangeNotification 16:33:21.450: ....change reason CategoryChange 16:33:21.539: AVAudioEngineConfigurationChangeNotification 16:33:21.542: Starting Audio Engine 16:33:23.863: AVAudioSessionRouteChangeNotification 16:33:23.863: ....change reason OldDeviceUnavailable 16:33:23.860 ERROR: [0x100a70000] AVAudioIONodeImpl.mm:317: ___ZN13AVAudioIOUnit11GetHWFormatEjPj_block_invoke: required condition is false: hwFormat *** Terminating app due to uncaught

Two action methods for an UIButton; next track and seek forward:

泪湿孤枕 提交于 2019-12-03 22:58:14
I am creating a music player application and it need that 2 actions to be called from a single button, one to skip to next track by touch up inside event and other to fast forward the curenttrack incase of a 'long press'. I don't know which event is pointing to this long press, i thought it to be touch down, but it worked only while holding the button. When i released the button, the track was skipped to next item. pls help AVAudioPlayer *appSoundPlayer;// declared in .h file In m file, the method: -(void)seekForwards{ NSTimeInterval timex; timex = appSoundPlayer.currentTime; timex = timex+5;

AVAudioPlayer working in Simulator, but not on device

流过昼夜 提交于 2019-12-03 22:55:58
My mp3 playing code is: NSError *error; soundObject = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:audioPathString] error:&error]; if (soundObject == nil) NSLog(@"%@", [error description]); soundObject.delegate = self; soundObject.numberOfLoops = 0; soundObject.volume = 1.0; NSLog(@"about to play"); [soundObject prepareToPlay]; [soundObject play]; NSLog(@"[soundObject play];"); The mp3 used to play fine, and it still does on the simulator . But not on the device. I've recently added some sound recording code (not mine) to the software. It uses AudioQueue stuff which is

Play one instance of AVAudioPlayer in the background

≯℡__Kan透↙ 提交于 2019-12-03 21:37:00
I have several instances of AVAudioPlayer in my app (in separate classes). I have added multi-tasking capabilities to one instance but all audio now plays in the background. I added the 'App plays audio' key to my plist and: [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; [[AVAudioSession sharedInstance] setActive: YES error: nil]; to my class. How can I target this code to only 1 instance of AVAudioPlayer? The only way around this I could find was the pause the specific AVAudioPlayer instance in: applicationWillResignActive I moved the creation of the

AVAudioPlayer - Metering - Want to build a waveform (graph)

﹥>﹥吖頭↗ 提交于 2019-12-03 20:55:14
问题 I need to build a visual graph that represents voice levels (dB) in a recorded file. I tried to do it this way: NSError *error = nil; AVAudioPlayer *meterPlayer = [[AVAudioPlayer alloc]initWithContentsOfURL:[NSURL fileURLWithPath:self.recording.fileName] error:&error]; if (error) { _lcl_logger(lcl_cEditRecording, lcl_vError, @"Cannot initialize AVAudioPlayer with file %@ due to: %@ (%@)", self.recording.fileName, error, error.userInfo); } else { [meterPlayer prepareToPlay]; meterPlayer

Play background music in app?

拟墨画扇 提交于 2019-12-03 20:50:41
问题 I want the user to be able to open the app and have music start playing. I want the user to be able to go any view controller and return back to the initial one without the music stopping. I want it to loop indefinitely. I have tried to put in the viewDidLoad method of the initial view controller for it to start playing. What happens is, the user leaves the initial view controller and when they come back, the music starts playing again, overlapping the original copy. To remedy this, I put an

What are the system sound ids for the new keyboard clicks in iOS 10?

笑着哭i 提交于 2019-12-03 17:41:24
问题 General I'm developing a third party keyboard and am currently trying to mimic the new keyboard clicks that Apple introduced in iOS 10b4. Current Situation The regular click sound can be played using AudioServicesPlaySystemSound(1104) but I can't seem to find the System Sound IDs for the two new other sounds. I've found the location of their .caf equivalents but those are way too loud to use, even after adjusting their volume using AVAudioPlayer . Question Is it possible to obtain the system

Resume background audio after AVAudioPlayer is paused

六眼飞鱼酱① 提交于 2019-12-03 17:22:15
I've developed an iPhone application that allows other apps to play audio in the background. To achieve this, I initialize my audio session like this: [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; At some point in my application I provide an audio player to play some files stored in CoreData with AVAudioPlayer. When the user hits the play button, the background audio should be paused. When the player has finished or is paused, the background audio should resume playback. While resuming after the player has finished playback with -(void

Setting and accessing iOS seek bar on lock screen

非 Y 不嫁゛ 提交于 2019-12-03 15:44:41
I am playing a audio file in iOS app using AVQueuePlayer/AVFoundation. i have set the MPNowPlayingInfoCenter's now playing information like album title, artist, Artwork, like this NSMutableDictionary *albumInfo = [[NSMutableDictionary alloc] init]; MPMediaItemArtwork *artworkP; UIImage *artWork = [UIImage imageNamed:album.imageUrl]; [albumInfo setObject:album.title forKey:MPMediaItemPropertyTitle]; [albumInfo setObject:album.auther forKey:MPMediaItemPropertyArtist]; [albumInfo setObject:album.title forKey:MPMediaItemPropertyAlbumTitle]; [albumInfo setObject:artworkP forKey