错误'!dat'试图设置(null)音频设备的采样率 [英] Error '!dat' trying to set the (null) audio devices' sample rate

查看:197
本文介绍了错误'!dat'试图设置(null)音频设备的采样率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试播放音频片段(使用AVAudioPlayer)和视频片段(使用MPMoviePlayerController),两者都正常工作。

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

然后我检查了文件进入SVN并将其拉到另一台Mac上。
现在当我试图播放音频或视频时运行应用程序(iPad应用程序)时,都会出错:

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:

错误'!dat'试图设置(null)音频设备的采样率

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

确定SVN损坏文件,(即使Mac的QuickLook会很好地播放它们),我用它们替换它们他们仍在使用的Mac版本。
但是我仍然收到错误。

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.

两台机器上的所有代码完全相同,但使用的原始Mac(MacBook Pro)将同时播放它们在模拟器中,但在第二台Mac(Mac Pro)上,它们不会播放并发出此错误。

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)

谢谢

播放音频的代码:

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];

更新:如果我在我的iPad上运行它(从我的Mac Pro),视频播放正常。它只是不能在我的Mac Pro模拟器上播放

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

推荐答案

是否有其他重新安装并且最终有效。仍然不知道问题是什么

Did another reinstall and it finally worked. Still no idea what the problem was

这篇关于错误'!dat'试图设置(null)音频设备的采样率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆