ios - Some audio url not playing on ios react native
问题描述
Im building a react native application which plays audio file from url(internet).
From the admin side we are providing 2 options. (upload audio and record audio).
Using react-mic on the admin side for recording audio.
The issue is the audio files which we upload is getting played properly in react native android and ios.(https://s3.eu-west-3.amazonaws.com/evolum/beginner_1.mp3)
But the recorded audio using react-mic is getting played in android but not in ios.(https://learnpodseditornodeserver.knomadixapp.com/b2748b8d36e12478e2d99ff6c04492a2.mp3)
I'm using react-native-sound to play audio on mobile.
Here's my code
const sound = new Sound(audioUrl, '', (error) => {
if (error) {
console.log('failed to load the sound', error); // this error
return;
}
// Play the sound with an onEnd callback
sound.play((success) => {
if (success) {
console.log('successfully finished playing');
} else {
console.log('playback failed due to audio decoding errors');
}
});
});
Here's the error i'm getting.
{
code: "ENSOSSTATUSERRORDOMAIN1954115647",
message: "The operation couldn’t be completed. (OSStatus error 1954115647.)",
nativeStackIOS: Array(19),
domain: "NSOSStatusErrorDomain",
userInfo: {
…
}
}
解决方案
尝试从初始化中删除 ''
const sound = new Sound(audioUrl, error => {
});
推荐阅读
- amazon-web-services - 在 Cloudformation 中重用一个 ALB?
- jquery - jQuery循环并获取表单字段值
- sql-server - Powershell:SqlCommand Where 子句总是返回空数据集
- javascript - $(document).ready(function (){} 以及它如何转换为 HTML
- flutter - Dart/Flutter : 日期范围内的日期列表
- python-3.x - 在 exp 错误中遇到溢出
- azure-machine-learning-service - 在推理配置中指定环境
- c# - 如何将网络字节转换为int?
- sql - 如何根据 sql 中的匹配数针对关键字数组搜索字符串并排序结果?
- c++ - 如何在我的 makefile 中包含目录及其所有子目录的标题?