react-native-sound
react-native-sound copied to clipboard
OSStatus error 1954115647 playing remote mp3 on iOS
react-native-cli: 2.0.1
react-native: 0.50.1
react-native-sound": "^0.10.9
resource: https://www.cxy61.com/program_girl/media/007/cn/a1/792215b831cb7b9a6074ba5feac3fa6236115e.mp3
{
code: "ENSOSSTATUSERRORDOMAIN1954115647",
message: "The operation couldn’t be completed. (OSStatus error 1954115647.)",
nativeStackIOS: Array(19),
domain: "NSOSStatusErrorDomain",
userInfo: {
…
}
}
how to fix issue? I need help.
I have the same problem on IOS!
const audio = new Sound(url, '', error => {
console.warn(`Failed to load the sound ${url}`, error);
});
I tried downloading the file first using fs and passing the full local path to the downloaded file but the same error! I have no issues on Android, it works perfectly.
Anyone have an idea about that? I getting same issue play url on ios. Some url from another domain working as well.
@chenweigh, @minhchienwikipedia : I faced the similar problem and managed to solve it. You need to add the sound file into Resources using XCode
It's 2019 and we can't play audio from a remote url? 😄 Did anyone solve this? Any pointers? I don't mind making a PR.
+1
This comment helped me out - https://stackoverflow.com/a/31244379/6660488
I was fetching mp3 files from the URLs.
I think when you fetch the URL as data and provide it to AVAudioPlayer
, sometimes there is an issue in the AVAudioPlayer
to recognise the file format, OS considers it as unsupported file format
.
I resolved the issue by adding fileTypeHint:AVFileTypeMPEGLayer3
to line 192 something like this in RNSound.m -
if ([fileName hasPrefix:@"http"]) {
fileNameUrl = [NSURL URLWithString:fileName];
NSData* data = [NSData dataWithContentsOfURL:fileNameUrl];
player = [[AVAudioPlayer alloc] initWithData:data fileTypeHint:AVFileTypeMPEGLayer3 error:&error];
}
any solution?
Still seeing this issue on iOS for an s3 bucket .wav file. Able to fetch and play audio on Android though.
After adding @SurajMDurgad change i now see that we are loading the sound correctly but I'm not able to play it, this is likely due to the difference that I'm trying to fetch .wav files and not mp3 files, checking into the other options for this
@Coffeegerm did u find any solution for .wav ??