Solved

unable to play audio file from document its terminates due to error

Posted on 2010-08-26
4
1,055 Views
Last Modified: 2013-11-25
when ever i try to play audio file its terminates due to error ?



2010-08-27 09:13:40.466 VoiceRecorder[3127:207] Failed with reason: The operation couldn’t be completed. (OSStatus error -43.)

what does it mean


i m physically storing file in Iphone Document folder and copying its name my database

so when ever i play it from data base it correctly get file path

and file name from document n database


 /Users/USERNAME/Library/Application Support/iPhone Simulator/4.0.1/Applications/6221AC9F-39A2-4441-BBB8-0E4C6BF5012C/Documents/27Aug10_09_12_34.aif
Current language:  auto; currently objective-c
2010-08-27 09:13:17.050 VoiceRecorder[3127:207] 27Aug10_09_12_34.aif

need an urgent reply

here is my code



-(IBAction)playevent{
	
	VoiceRecorderAppDelegate *appDelegate=(VoiceRecorderAppDelegate*)[[UIApplication sharedApplication]delegate];
	
	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
	NSString *documentsDir = [paths objectAtIndex:0];
	NSString *fullpath = [documentsDir stringByAppendingPathComponent:appDelegate.filenamefrompath];
	
	
	
	
	NSFileManager *fileManager = [NSFileManager defaultManager];
	
	// Check if the database has already been created in the users filesystem
	BOOL success = [fileManager fileExistsAtPath:fullpath];
	
	// If the database already exists then return without doing anything
	if(success) { NSLog(@"Yes exists"); }else{ NSLog(@"no"); }
	
	
	//return [documentsDir stringByAppendingPathComponent:appDelegate.filenamefrompath];
	NSError* err;
	NSLog(@"%@",fullpath);
	player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:fullpath] error:&err];

	
	//NSString *filePath = [[NSBundle mainBundle] pathForResource:appDelegate.filenamefrompath ofType:@"aif"];
//	NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath];
//	player = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:nil];

	
	NSLog(@"%@",appDelegate.filenamefrompath);
	player.delegate = self;
	
	if( err ){
		//bail!
		NSLog(@"Failed with reason: %@", [err localizedDescription]);
	}
	
	
	[player play];


}

Open in new window

0
Comment
Question by:IamnotanExpert007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 10

Accepted Solution

by:
robertcerny earned 250 total points
ID: 33539937
OSStatus error -43 means File Not Found
0
 
LVL 3

Author Comment

by:IamnotanExpert007
ID: 33540293
But I m get each n every thing right

loging each step i dont know why i m getting this error


will you please examine my code given above
0
 
LVL 3

Author Comment

by:IamnotanExpert007
ID: 33614258
Well Problem solved i m using date Function to give file name like hh-MM-ss so when ever i start recording its name like 15_24_20
when i save its name changed with respect to time 15_24_56 thats why it keep saying file not found


thanks
0
 
LVL 3

Author Closing Comment

by:IamnotanExpert007
ID: 33614263
Problem Solved
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question