Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
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 switch statements in the C programming language.

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now