React-native-sound: Some url sound not playing in IOS

Created on 15 Oct 2018  路  7Comments  路  Source: zmxv/react-native-sound

Versions

React Native Cli: 2.0.1
React Native: 0.55.4
React Native Sound: 0.10.9
X-Code: 9 and 10

Description

Some urls doesn't play in IOS, and the ones that manages to play tends to be slow.

Code

Works

const url = 'https://ec-preview-media.sndcdn.com/preview/0/30/XAGPkjLItbgN.128.mp3?f10880d39085a94a0418a7e162b03d52e21adf826af17a391e1a7411352e94fa09cf19379bc361d4e59dd2e7345f5002a14aa8b66f97e06fb11a5b2b6c53670ccd89695fa398bd1185b325f67f3f297ea0fe';

// Works in Both IOS and Android but slow in IOS
Sound.setCategory('Playback');
this.sound = new Sound(url, null, (error) => {
    if (error) {
        console.log('failed to load the sound', error);
        return;
    }
    this.sound.play();
});

Doesn't Work

const url = 'https://edge2-b.exa.live365.net/a26993';

// Works only on Andriod
Sound.setCategory('Playback');
this.sound = new Sound(url, null, (error) => {
    if (error) {
        console.log('failed to load the sound', error);
        return;
    }
    this.sound.play();
});

Wondering if am doing anything wrong.

Most helpful comment

I getting same issue with this error
{ "code": "ENSOSSTATUSERRORDOMAIN2003334207", "domain": "NSOSStatusErrorDomain", "message": "The operation couldn鈥檛 be completed. (OSStatus error 2003334207.)", "nativeStackIOS": Array [ "0 projectname 0x000000010d312157 RCTJSErrorFromCodeMessageAndNSError + 135", "1 projectname 0x000000010d312083 RCTJSErrorFromNSError + 275", "2 projectname 0x000000010d20db58 -[RNSound prepare:withKey:withOptions:withCallback:] + 1624", "3 CoreFoundation 0x0000000112de111c __invoking___ + 140", "4 CoreFoundation 0x0000000112dde5b5 -[NSInvocation invoke] + 325", "5 CoreFoundation 0x0000000112ddea06 -[NSInvocation invokeWithTarget:] + 54", "6 projectname 0x000000010d2a1f4a -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2810", "7 projectname 0x000000010d3596b6 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 790", "8 projectname 0x000000010d3591cf _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 127", "9 projectname 0x000000010d359149 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25", "10 libdispatch.dylib 0x00000001146df5d1 _dispatch_call_block_and_release + 12", "11 libdispatch.dylib 0x00000001146e063e _dispatch_client_callout + 8", "12 libdispatch.dylib 0x00000001146e7b47 _dispatch_lane_serial_drain + 791", "13 libdispatch.dylib 0x00000001146e87c0 _dispatch_lane_invoke + 428", "14 libdispatch.dylib 0x00000001146f28b8 _dispatch_workloop_worker_thread + 733", "15 libsystem_pthread.dylib 0x0000000114a7461c _pthread_wqthread + 409", "16 libsystem_pthread.dylib 0x0000000114a74415 start_wqthread + 13", ], "userInfo": Object {}, }

All 7 comments

I facing the same problem.

I facing the same problem. No issues at all when running in Debug mode, but when running my release build,no sound,no warning,no error .

const callback = (error) => {
        if (error) {
            if (__DEV__) {
                console.log(error);
            }
            return;
        }
        sound.setVolume(0.6).play(() => { });
    };
    const sound = new Sound(require('../sound/ring.mp3'), (error) => callback(error));

I getting same issue with this error
{ "code": "ENSOSSTATUSERRORDOMAIN2003334207", "domain": "NSOSStatusErrorDomain", "message": "The operation couldn鈥檛 be completed. (OSStatus error 2003334207.)", "nativeStackIOS": Array [ "0 projectname 0x000000010d312157 RCTJSErrorFromCodeMessageAndNSError + 135", "1 projectname 0x000000010d312083 RCTJSErrorFromNSError + 275", "2 projectname 0x000000010d20db58 -[RNSound prepare:withKey:withOptions:withCallback:] + 1624", "3 CoreFoundation 0x0000000112de111c __invoking___ + 140", "4 CoreFoundation 0x0000000112dde5b5 -[NSInvocation invoke] + 325", "5 CoreFoundation 0x0000000112ddea06 -[NSInvocation invokeWithTarget:] + 54", "6 projectname 0x000000010d2a1f4a -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2810", "7 projectname 0x000000010d3596b6 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 790", "8 projectname 0x000000010d3591cf _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 127", "9 projectname 0x000000010d359149 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25", "10 libdispatch.dylib 0x00000001146df5d1 _dispatch_call_block_and_release + 12", "11 libdispatch.dylib 0x00000001146e063e _dispatch_client_callout + 8", "12 libdispatch.dylib 0x00000001146e7b47 _dispatch_lane_serial_drain + 791", "13 libdispatch.dylib 0x00000001146e87c0 _dispatch_lane_invoke + 428", "14 libdispatch.dylib 0x00000001146f28b8 _dispatch_workloop_worker_thread + 733", "15 libsystem_pthread.dylib 0x0000000114a7461c _pthread_wqthread + 409", "16 libsystem_pthread.dylib 0x0000000114a74415 start_wqthread + 13", ], "userInfo": Object {}, }

Me too anyone can help ?

here is the URL: https://s3.eu-west-3.amazonaws.com/evolum/beginner_1.mp3
"react-native-sound": "^0.10.9",

Causing lib error.
This is fixed example repo: https://github.com/ctlabvn/RNSound-fix-remote-url

Related to #292?

Was this page helpful?
0 / 5 - 0 ratings