zmxv / react-native-sound

React Native module for playing sound clips

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

failed to load the sound {"code": "ENSOSSTATUSERRORDOMAIN-10875", "domain": "NSOSStatusErrorDomain", "message": "The operation couldn’t be completed. (OSStatus error -10875.)

jinglongbu opened this issue · comments

in iOS,when the resources path is local file it work ,but when is the link as https://abc.mp3,it can not work and err is

{"code": "ENSOSSTATUSERRORDOMAIN-10875", "domain": "NSOSStatusErrorDomain", "message": "The operation couldn’t be completed. (OSStatus error -10875.)", "nativeStackIOS": ["0 rndemo 0x000000010298fe0c RCTJSErrorFromCodeMessageAndNSError + 116", "1 rndemo 0x000000010298fd58 RCTJSErrorFromNSError + 256", "2 rndemo 0x000000010285c828 -[RNSound prepare:withKey:withOptions:withCallback:] + 1368", "3 CoreFoundation 0x00000001ab5cbfc4 7769FFAC-4FCD-332D-A4BE-DA2F0E2FFEA5 + 1277892", "4 CoreFoundation 0x00000001ab4957d0 7769FFAC-4FCD-332D-A4BE-DA2F0E2FFEA5 + 6096", "5 CoreFoundation 0x00000001ab4963f0 7769FFAC-4FCD-332D-A4BE-DA2F0E2FFEA5 + 9200", "6 rndemo 0x00000001029283e0 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 1828", "7 rndemo 0x000000010292bf1c _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicEiN12_GLOBAL__N_117SchedulingContextE + 1156", "8 rndemo 0x000000010292b8bc _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 144", "9 rndemo 0x000000010292b820 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28", "10 libdispatch.dylib 0x00000001ab266134 E749B178-A64D-3363-83EF-863A6073A06B + 8500", "11 libdispatch.dylib 0x00000001ab2675ac E749B178-A64D-3363-83EF-863A6073A06B + 13740", "12 libdispatch.dylib 0x00000001ab26da64 E749B178-A64D-3363-83EF-863A6073A06B + 39524", "13 libdispatch.dylib 0x00000001ab26e498 E749B178-A64D-3363-83EF-863A6073A06B + 42136", "14 libdispatch.dylib 0x00000001ab277a5c E749B178-A64D-3363-83EF-863A6073A06B + 80476", "15 libsystem_pthread.dylib 0x00000001ab2cd718 _pthread_wqthread + 276", "16 libsystem_pthread.dylib 0x00000001ab2d39c8 start_wqthread + 8"], "userInfo": {}}

in android whatever path is local file or link They can all work

this is my code

`let url = 'https://test.com/art01.mp3';
let musciPath = require('@src/resources/art01.mp3');
let music = new Sound( url,'', (error) => {
console.log(66665);
if (error) {
console.log('failed to load the sound', error);
// Alert.alert('Notice', 'audio file error. (Error code : 1)');

} else {
    music.play()


}

});`
can someone help me? thanks very much

I have the same problem, except it is not working with audio files from Firebase Storage. I can play sounds from URL with other domains. NSAllowsArbitraryLoads is set to true.

Same issue, been digging into the native code and the player is most likely getting passed nil data for initilization and thats where the error is being throwm, how to solve this? Not sure yet, but have been taking a look for a bit now and it's blocking a feature for us here

same issue here

Same issue, been digging into the native code and the player is most likely getting passed nil data for initilization and thats where the error is being throwm, how to solve this? Not sure yet, but have been taking a look for a bit now and it's blocking a feature for us here

Are you using Firebase? Because my guess is that the iOS audio player component cannot load URLs containing characters like %2F, which are parts of Firebase Storage URLs.

See my comment here, if the above comment is true, you may have to undo the encoding on the url

I still can't play url from firebase ?

Yes storage links will not work in IOS, but you can use "React-native-blob-utils", using this lib, pass storage url and download that file locally and pass that locally downloaded path to sound library. that will work.