我正在尝试播放音频剪辑(使用AVAudioPlayer)和视频剪辑(使用MPMoviePlayerController),它们都正常工作。
然后我将文件签入到SVN中,并将它们下载到另一台Mac上。现在,当我运行应用程序(iPad应用程序),当它试图播放音频或视频时,两者都给出了错误:
尝试设置(空)音频设备的采样率时出现错误'!dat‘
考虑到SVN损坏了这些文件(尽管Mac的QuickLook可以很好地播放它们),我将它们替换为在Mac上仍然有效的版本。然而,我仍然得到了错误。
所有的代码在两台机器上都是完全相同的,但最初使用的Mac (Mac )将在模拟器中播放它们,但在第二台Mac (Mac Pro)上它们不会播放,并给出此错误。
有没有人知道这个错误意味着什么,或者我如何修复它(因为覆盖媒体文件不起作用)
谢谢
音频播放代码:
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上),视频可以正常播放。它不能在我的Mac Pro的模拟器上运行
发布于 2012-01-07 01:53:40
做了另一次重装,它终于可以工作了。仍然不知道问题出在哪里
发布于 2011-08-10 05:11:56
好几天都有同样的问题(非常烦人)。我设法通过更改系统偏好设置下的音频输入设置来修复它。
系统首选项->声音->输入
发布于 2013-01-21 03:07:04
我也有同样的问题。下面是我所做的:
关闭xcode和simulator
的任何音频设备
https://stackoverflow.com/questions/6752192
复制相似问题