Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error '!dat' trying to set the (null) audio devices' sample rate

I am trying to play an audio clip (using AVAudioPlayer) and a video clip (using MPMoviePlayerController), both of which were working.

I then checked the files into SVN and pulled them down on another Mac. Now when I run the app (iPad app) when it tries to play either the audio or video, both give the error:

Error '!dat' trying to set the (null) audio devices' sample rate

Figuring that SVN corrupted the files, (even though the Mac's QuickLook will play them fine), I replaced them with the versions on the Mac where they still work. However I am still getting the error.

All code is exactly the same on both machines, but the original Mac used (MacBook Pro) will play them both in the simulator, but on the second Mac (Mac Pro) they will not play and give this error.

Does anyone know what this error means, or how I can fix it (since overwritting the media files didnt work)

Thanks

Code for playing the audio:

NSError *error;

[[AVAudioSession sharedInstance] setDelegate:self];
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
[[AVAudioSession sharedInstance] setActive:YES error:&error];

NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/Page_7.m4a", [[NSBundle mainBundle] resourcePath]]];

if (audioPlayer == nil)
{
    audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
    audioPlayer.numberOfLoops = 0;
}

if (audioPlayer == nil)
    NSLog(@"%@", [error description]);
else
    [audioPlayer play];

Update: If I run it on my iPad (from my Mac Pro) the video plays fine. It just won't play on my Mac Pro's Simulator

like image 473
kdbdallas Avatar asked Jul 19 '11 18:07

kdbdallas


1 Answers

had the same problem for several days (extremely annoying). I managed to fix it by changing the input settings for audio under system preferences.

System Preferences -> Sound -> Input

like image 116
tdeegan Avatar answered Sep 23 '22 17:09

tdeegan