Solved

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

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to understand recursion 12 224
Intel debugger, idb, only seeing .c and .h, but no .f90 1 317
Why is compiler in oracle server ? 9 64
Constant string is of type char *   ? 7 28
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
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…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

806 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