Solved

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

Posted on 2010-08-26
4
1,054 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
  • 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
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…
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 how to create, access, and change arrays in the C programming language.

860 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