Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I send voice note from android to IOS, then failed to load sound in IOS. #841

Open
2 tasks
akshaySimublade opened this issue Jul 1, 2024 · 2 comments
Open
2 tasks
Labels

Comments

@akshaySimublade
Copy link

akshaySimublade commented Jul 1, 2024

🪲 Description

🪲 What is the observed behavior?

When I send a voice note from android to ios, then in ios that voice note is loading.
Error -> {"code": "ENSOSSTATUSERRORDOMAIN2003334207", "domain": "NSOSStatusErrorDomain", "message": "The operation couldn’t be completed. (OSStatus error 2003334207.)", "nativeStackIOS": ["0 OPAR-Development 0x00000001055150b8 RCTJSErrorFromCodeMessageAndNSError + 112", "1 OPAR-Development 0x0000000105515008 RCTJSErrorFromNSError + 236", "2 OPAR-Development 0x0000000105408954 -[RNSound prepare:withKey:withOptions:withCallback:] + 1288", "3 CoreFoundation 0x000000019c23d814 00E76A98-210C-3CB5-930B-F236807FF24C + 133140", "4 CoreFoundation 0x000000019c23c860 00E76A98-210C-3CB5-930B-F236807FF24C + 129120", "5 CoreFoundation 0x000000019c2b31dc 00E76A98-210C-3CB5-930B-F236807FF24C + 614876", "6 OPAR-Development 0x00000001054baf84 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 1796", "7 OPAR-Development 0x00000001054bf020 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicEiN12_GLOBAL__N_117SchedulingContextE + 1688", "8 OPAR-Development 0x00000001054be7bc _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 128", "9 OPAR-Development 0x00000001054be730 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28", "10 libdispatch.dylib 0x00000001a414413c 81D355DF-266A-3010-BAB8-113B76A206C1 + 8508", "11 libdispatch.dylib 0x00000001a4145dd4 81D355DF-266A-3010-BAB8-113B76A206C1 + 15828", "12 libdispatch.dylib 0x00000001a414d400 81D355DF-266A-3010-BAB8-113B76A206C1 + 46080", "13 libdispatch.dylib 0x00000001a414df30 81D355DF-266A-3010-BAB8-113B76A206C1 + 48944", "14 libdispatch.dylib 0x00000001a4158cb4 81D355DF-266A-3010-BAB8-113B76A206C1 + 93364", "15 libdispatch.dylib 0x00000001a4158528 81D355DF-266A-3010-BAB8-113B76A206C1 + 91432", "16 libsystem_pthread.dylib 0x00000001f90f7934 _pthread_wqthread + 288", "17 libsystem_pthread.dylib 0x00000001f90f40cc start_wqthread + 8"], "userInfo": {}}

Same voice note is working fine on android from which I have send it to IOS. If i sent voice note from IOS to android, then also it is working fine in both devices android and IOS.
Error occurs only when I send sound note from android to IOS, then In IOS, sound file not loading.

🪲 What is the expected behavior?

🪲 Please post your code:

            const path = RNFS.CachesDirectoryPath +'/upload.mp4'

            RNFS.writeFile(path, item?.voiceNote, 'base64').then(() => playSound(),
              console.log("checkkknoooooo",path)
            
            )
            // const localWavPath = await decodeOpus(item?.voiceNote);

            const playSound = () => {


                

                // Sound.setCategory('Playback');
                                        //  /Users/mac/Library/Developer/CoreSimulator/Devices/8E6CD5CD-54C8-4853-B65C-1FC8FEF4B413/data/Containers/Data/Application/334DD96F-2430-45A1-8F1C-365D76A0A6C4/Library/Caches/upload.mp4
                item.audio = new Sound(path,'', (error) => {
                    if (error) {
                        console.log('failed to load the sound ', error);
                        return;
                    }
                    // loaded successfully
          
                    currrentAudio = item.audio
                    const tempArray = [...userMessage]
                    const index = tempArray.findIndex((element) => element.time === messageId)
                    tempArray[index].isPlaying = true
                    console.log("check the array", tempArray);
                    setUserMessage(tempArray)
                    item?.audio.play((success) => {
                        if (success) {
                            console.log('successfully finished playing');
                            const tempArray = [...userMessage]
                            const index = tempArray.findIndex((element) => element.time === messageId)
                            tempArray[index].isPlaying = false
                            setUserMessage(tempArray)

                        } else {
                            console.log('playback failed due to audio decoding errors');
                        }
                    });
                })
            }
            // const callback = () => sound.play(successCallback)
            // return;
// Please post your code

💡 Does the problem have a test case?

💡 Possible solution

💡 Is there a workaround?

💡 If the bug is confirmed, would you be willing to create a pull request?

Is your issue with...

  • iOS

Are you using...

  • React Native CLI (e.g. react-native run-android)

Which versions are you using?

  • React Native Sound: "^0.11.2",
  • React Native: "^0.73.4"

Does the problem occur on...
Device

If your problem is happening on a device, which device?

  • Device: IOS
@rossicler-hostalky
Copy link

Did you find how to fix this?

@xinkuiwu
Copy link

same!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants