Expo AV audio not playing on iOS/ iPhone(Expo AV 音频无法在 iOS/iPhone 上播放)
问题描述
我使用 Expo AV 并在我的应用程序中开发了一个屏幕来播放从我的服务器获取的音频文件.它在 Android 上运行良好,但在 iPhone 上无法播放.
I have used Expo AV and developed a screen in my app to play audio files fetched from my server. It works fine on Android, but doesn't play anything on iPhone.
当我播放按钮来播放加载和播放文件的音频时
When I play a button to play the audio which loads and plays the file
soundObject.loadAsync({ uri: this.state.file });
soundObject.playAsync();
它返回一个错误:
不支持此媒体格式.- AVPlayerItem 实例失败,错误代码为 -11828,域为AVFoundationErrorDomain".
This media format is not supported. - The AVPlayerItem instance has failed with the error code -11828 and domain "AVFoundationErrorDomain".
这是我加载和播放音频的代码:
Here is my code that loads and plays the audio :
async loadAudio() {
soundObject = new Audio.Sound();
try {
await soundObject.loadAsync({ uri: this.state.file });
console.log("File loaded: " + this.state.file);
} catch (error) {
console.log(error);
}
}
async playAudio() {
if (!this.state.isPlayingAudio) {
try {
await soundObject.playAsync();
} catch (error) {
console.log(error);
}
else {
soundObject.pauseAsync();
}
}
我在录制和获取文件时尝试将音频格式更改为 m4a、wav、caf,但这没有帮助我在 iPhone 7 plus、iOS 14.2 上运行该应用程序请问有什么建议/修复吗?提前致谢
I have tried changing the audio format to m4a, wav, caf while recording and fetching the file but that did not help I'm running the app on iPhone 7 plus, iOS 14.2 Any suggestions/ fixes, please? Thanks in advance
推荐答案
我参加了 44 世博会,降级到 42 世博会成功了.运行 expo upgrade 42
.
I was on Expo 44, downgrading to Expo 42 did the trick. Run expo upgrade 42
.
这篇关于Expo AV 音频无法在 iOS/iPhone 上播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Expo AV 音频无法在 iOS/iPhone 上播放


- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- Android - 拆分 Drawable 2022-01-01