avaudioplayer

Playing audio file while I download it

随声附和 提交于 2020-01-14 16:32:27
问题 I am trying to play partially downloaded file (I want the audio to start when it has enough downloaded data). I have tried the following: self.mutableData = nil; self.mutableData = [NSMutableData data]; self.mutableData.length = 0; GTMHTTPFetcher *fetcher = [[self driveService].fetcherService fetcherWithURLString:song.filePath]; [fetcher setReceivedDataBlock:^(NSData *dataReceivedSoFar) { [self.mutableData appendData:dataReceivedSoFar]; if (!self.audioPlayer.playing && self.mutableData.length

How can I Add Audio Player in iphone App

穿精又带淫゛_ 提交于 2020-01-14 06:50:11
问题 I want to add audio player in my app.I have no idea about it. I want to play songs and make playlist also...how can i do this? 回答1: You can find tutorial from the following link:- http://mobileorchard.com/easy-audio-playback-with-avaudioplayer/ or http://psychicparrotgames.com/?p=33 or http://www.codeproject.com/KB/iPhone/abPlayer_iPhone.aspx Hope it helps you. 回答2: go through following links, it will help you - http://mobileorchard.com/easy-audio-playback-with-avaudioplayer/ http://mobile

Help stopping audio using AVAudioPlayer

岁酱吖の 提交于 2020-01-13 07:33:09
问题 Alright I have two problems. I'm using AVAudioPlayer to play a simple audio file in .caf format. What I'm trying to do is have a play and pause button. Here is a sample of a simple IBAction to play the audio from a button. - (IBAction) clear { NSString *path = [[NSBundle mainBundle] pathForResource:@"clear" ofType:@"caf"]; AVAudioPlayer* myAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL]; myAudio.delegate = self; myAudio.volume = 1.0; myAudio

Help stopping audio using AVAudioPlayer

和自甴很熟 提交于 2020-01-13 07:33:08
问题 Alright I have two problems. I'm using AVAudioPlayer to play a simple audio file in .caf format. What I'm trying to do is have a play and pause button. Here is a sample of a simple IBAction to play the audio from a button. - (IBAction) clear { NSString *path = [[NSBundle mainBundle] pathForResource:@"clear" ofType:@"caf"]; AVAudioPlayer* myAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL]; myAudio.delegate = self; myAudio.volume = 1.0; myAudio

How to handle error code -43 from NSOSStatusErrorDomain when initializing AVAudioPlayer Object?

妖精的绣舞 提交于 2020-01-10 11:53:59
问题 I observed strange behavior while working with AVAudioPlayer Following is the code: AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL: [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@",fileName]] error: &error]; In this, I downloaded the file from server and stored in application's Cache directory. I am getting following error: Error in playing = Domain = NSOSStatusErrorDomain Code = -43 Description = Error Domain=NSOSStatusErrorDomain Code=-43 "The operation

Play a paused AVAudioRecorder file

空扰寡人 提交于 2020-01-09 11:10:30
问题 in my program I want the user to be able to: record his voice, pause the recording process, listen to what he recorded and then continue recording. I have managed to get to the point where I can record and play the recordings with AVAudioRecorder and AVAudioPlayer. But whenever I try to record, pause recording and then play, the playing part fails with no error. I can guess that the reason it's not playing is because the audio file hasn't been saved yet and is still in memory or something. Is

AVAudioPlayer memory leak

青春壹個敷衍的年華 提交于 2020-01-09 07:18:32
问题 I'm stuck on some weird memory leak problem related to the AVAudioPlayer and I need help after trying everything that came to mind. Here is the short description of the problem - code appears right after. I initialize my player and start to play the sound track in an endless loop (and endless loop or one time play did not change the problem). Several seconds after the music started, I switch to another sound track, hence I create a new player, initialize it, release the old one (which is

AvAudioPlayer not working?

Deadly 提交于 2020-01-07 01:22:37
问题 I create the AVAudioPlayer object and play the music within the scene, if i transition through to another scene and then go back to the original scene it creates another object and plays the same soundtrack twice. How do i overcome this ? NSURL *url = [[NSBundle mainBundle] URLForResource:@"backgroundMusic" withExtension:@"mp3"]; self.backgroundMusic = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:nil]; self.backgroundMusic.numberOfLoops = -1; [self.backgroundMusic prepareToPlay]; if

AvAudioPlayer not working?

廉价感情. 提交于 2020-01-07 01:22:28
问题 I create the AVAudioPlayer object and play the music within the scene, if i transition through to another scene and then go back to the original scene it creates another object and plays the same soundtrack twice. How do i overcome this ? NSURL *url = [[NSBundle mainBundle] URLForResource:@"backgroundMusic" withExtension:@"mp3"]; self.backgroundMusic = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:nil]; self.backgroundMusic.numberOfLoops = -1; [self.backgroundMusic prepareToPlay]; if

Problem while playing sound using AVAudioPlayer?

纵然是瞬间 提交于 2020-01-06 19:39:32
问题 In my app, I am playing sound from library directory. Here sounds are stored in different folders with different naming conventions. For example, Folders like : Test , Test 2 Now when I try to play sound from Test , it plays sound. But when I try to play sound from Test 2 , It is not playing any sound. I am using following code for playing sound : recordFile : "/Users/taxsmart2/Library/Application Support/iPhone Simulator/4.3/Applications/E2F2C422-605A-4EC7-A40A-7429A966351C/Library/List13