ios - OSStatus 错误 2003334207 AVAudioPlayer
问题描述
我正在尝试播放从 iTunes API 获得的音频 url。它们是 m4a 类型。我将 URL 保存为字符串并将其发送到我的 playSound 函数。我查看了其他有此错误的帖子,但无法修复我的。
示例音频网址
我收到错误“错误:无法完成操作。(OSStatus 错误 2003334207。)”
func playSound(soundUrl: String) {
let sound = NSURL(fileURLWithPath: soundUrl)
do {
let audioPlayer = try AVAudioPlayer(contentsOf: sound as URL)
audioPlayer.delegate = self as? AVAudioPlayerDelegate
audioPlayer.prepareToPlay()
audioPlayer.play()
}catch let error {
print("Error: \(error.localizedDescription)")
}
}
解决方案
推荐阅读
- reactjs - 如何检查完全渲染的 React 子组件,包括其中的 AJAX 调用?
- r - 将 .byte 文件读入 R
- javascript - 响应式菜单未在单击时关闭
- ios - 未调用 IOS 13 APNS didRegisterForRemoteNotificationsWithDeviceToken
- amazon-web-services - 具有 jenkins 构建阶段的代码管道的 AWS Cloudformation 模板
- xcode - 无法将下面的视图添加到情节提要中的标签
- azure - 来自特定文档的自定义技能的天蓝色搜索索引器的响应是:无法执行技能。WebApi 技能响应包含错误
- javascript - 在 nuxt.js 路由之后令牌未定义
- php - 在 Laravel 上读取上传的 CSV 时在每个字母之间获取未知字符
- react-native - 有没有办法在反应原生博览会中按下按钮重新加载应用程序?