简体   繁体   English

某些音频 url 无法在 ios 上播放本机反应

[英]Some audio url not playing on ios react native

Im building a react native application which plays audio file from url(internet).我正在构建一个反应原生应用程序,它播放来自 url(互联网)的音频文件。

From the admin side we are providing 2 options.从管理员方面,我们提供 2 个选项。 (upload audio and record audio). (上传音频并录制音频)。

Using react-mic on the admin side for recording audio.在管理员端使用react-mic录制音频。

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 )问题是我们上传的音频文件在反应原生 android 和 ios 中正常播放。( https://s3.eu-west-3.amazonaw1.mp3

But the recorded audio using react-mic is getting played in android but not in ios.( https://learnpodseditornodeserver.knomadixapp.com/b2748b8d36e12478e2d99ff6c04492a2.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.我正在使用react-native-sound在移动设备上播放音频。

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: {
    …
 }
}

Try removing '' from initialization尝试从初始化中删除 ''

const sound = new Sound(audioUrl, error => {
  
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM