iphone - AVAudioPlayer -> not working -


If I start it 20 to 30 times the audio player works fine, but after that it shows the following error

Error domain = NSOSStatusErrorDomain code = -43 "operation can not be completed. (OSStatus error -43.)"

Currently the code I'm using is as follows

  - (zero) PlayShortSound: (NSString *) File name: (NSString *) Type {if (IsSound) {return; } NSString * soundFilePath = [[NSBundle main bundle] pathForResource: fileName ofType: type]; NSURL * fileURL = [[[NS URL light] initFileURLWithPath: soundFilePath] AutoExecution]; NSError * error; AviDio Player * New Player = [[AviPro Player Alok] initWithContentsOfURL: fileURL Error: & amp; Error]; //newPlayer.numberOfLoops = 0; NewPlayer.volume = 1.0; If (newpelder == zero) {NSLog (@ "% @", [error description]); // [self gameshortSound: filename type: type]; // Return; } And {[newplayer play]; NewPlayer.delegate = self; }} - (zero) AudioplayerFinish Playing: (AviPro Player) successfully: (BOL) completed {if (full == yes) {NSLog (@ "Playing the Sound"); } Other {NSLog ("error in completion of @% @", player.url); }}    

I had the same problem and instead of input the player, Was made from.

  NSString * soundFilePath = [[NSBundle main bundle] Pathfinder resource: Type the name of the file type: type]; NSDTA * SoundData = [[NSDTTA Alloc] INNTH WITH CONTENT OFFFILE: SoundFilePath]; NSError * error; AviAyoplayer * New Player = [[AviPro Player Alok] initWithData: SoundData Error: & amp; Error];   

It seems to be a solution to my problem that it is yours.

Comments