【问题标题】:AVAudioRecorder error "playback data format is unsupported" on iOS?iOS上的AVAudioRecorder错误“不支持播放数据格式”?
【发布时间】:2011-08-16 23:43:21
【问题描述】:

下面的代码抛出 OSStatus 错误 1718449215,根据Audio Queue Reference,表示“播放数据格式不受支持。”

如果我将AVFormatKey 更改为kAudioFormatiLBCkAudioFormatLinearPCM,代码可以正常工作。 iOS 是否支持使用 kAudioFormatMPEG4AAC_HE 录制?

NSDictionary *settings = 
   [NSDictionary dictionaryWithObjectsAndKeys:
   [NSNumber numberWithFloat: 32000.0],                AVSampleRateKey,
   [NSNumber numberWithInt: kAudioFormatMPEG4AAC_HE],  AVFormatIDKey,
   [NSNumber numberWithInt: 1],                        AVNumberOfChannelsKey,
   [NSNumber numberWithInt: AVAudioQualityMedium],     AVEncoderAudioQualityKey,
nil];

NSError *error = nil;
AVAudioRecorder *avRecorder = [[AVAudioRecorder alloc] 
                                initWithURL:url 
                                settings:settings 
                                error:&error];

NSAssert(error.code != 1718449215,  @"The playback data format is unsupported.");

【问题讨论】:

    标签: objective-c ios cocoa-touch ios4


    【解决方案1】:

    Apple 文档,特别是多媒体编程指南 (http://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/MultimediaPG/UsingAudio/UsingAudio.html),仅将 HE-AAC 列为播放格式。为播放和录制列出了常规 AAC。所以,看起来 HE-AAC 只是部分支持。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-14
      • 1970-01-01
      • 1970-01-01
      • 2019-09-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多