iOS 音频文件无法在桌面网络浏览器中播放

标签 ios html avaudiorecorder

为什么Safari/Chrome无法播放使用AVAudioRecorder创建的文件?

这是我的录音机设置:

private static let settings = [
        AVFormatIDKey: NSNumber(unsignedInt: kAudioFormatMPEG4AAC),
        AVNumberOfChannelsKey: 2,
        AVSampleRateKey: 44100,
        AVEncoderBitRateKey: 128000,
        AVEncoderAudioQualityKey: NSNumber(long: AVAudioQuality.Max.rawValue)
    ]

读者:

<audio controls>
  <source src="MD_31E5106A-2901-49ED-8492-D29A654B826D" type="audio/mp4">
</audio>

我尝试了几种设置,都没有成功。所有文件都可以用 VLC 播放。

这是一个示例文件:http://cl.ly/1l0z231x322l

编辑:读者代码

最佳答案

如果我们有 URL 的扩展,它就可以工作

recordURL = recordURL.URLByAppendingPathExtension("m4a") 
recorder = try AVAudioRecorder(URL: recordURL, settings: AudioRecorder.settings)

关于iOS 音频文件无法在桌面网络浏览器中播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33079413/

相关文章:

ios - 为什么 'self.navigationController?.pushViewController(mainPage, animated: true)' 不起作用?

html - 如何在 IE(9+) 和 Safari (Pad) 中使用 HTML5 音频播放 .m4a?

c# - 从 MVC 中的 FormCollection 中获取选定的下拉列表值

ios - AVAudioRecorder最小的音频类型是什么

iOS:如何在 .aif 录音的开始和结束时修剪静音?

iphone - iPhone SDK 中鼠标向下和向上的手势识别器

iphone - 获取我的应用程序是否被授权使用 facebook [iOS 6, FB SDK 3.2]

ios - 在 iOS 上的 open gl es 2.0 中缩放对象以适合屏幕

php - 我需要为此页面添加分页,因为我正在从 db 动态获取一组元素

ios - AVAudioSession swift