据我所知,我正在加载正确的资源。但是,当我尝试使用 React Native Sound 播放声音时,我仍然收到以下错误:
Argument 1 (RCTResponseSenderBlock) of RNSound.play must not be null
如何修复此错误?
我检查了保存声音对象的变量,看起来它已加载:
LOG this.outgoingCall {"_duration": 18.1811875, "_filename": "http://localhost:8081/assets/assets/sounds/dialing.mp3?platform=ios&hash=717d95726264d7105360ce45119c9e0e", "_key": 35, "_loaded": true, "_numberOfChannels": 2, "_numberOfLoops": 0, "_pan": 0, "_pitch": 1, "_playing": false, "_speed": 1, "_volume": 1, "onPlaySubscription": {"remove": [Function remove]}, "registerOnPlay": [Function anonymous]}
LOG this.incomingCall {"_duration": 5.224458333333334, "_filename": "http://localhost:8081/assets/assets/sounds/calling.mp3?platform=ios&hash=0707a09b5a0268a9cb3e6f9b8d5b32ec", "_key": 36, "_loaded": true, "_numberOfChannels": 2, "_numberOfLoops": 0, "_pan": 0, "_pitch": 1, "_playing": false, "_speed": 1, "_volume": 1, "onPlaySubscription": {"remove": [Function remove]}, "registerOnPlay": [Function anonymous]}
LOG this.endCall {"_duration": 1.306, "_filename": "http://localhost:8081/assets/assets/sounds/end_call.mp3?platform=ios&hash=90aad40264cc274ce67046ab241054c0", "_key": 37, "_loaded": true, "_numberOfChannels": 2, "_numberOfLoops": 0, "_pan": 0, "_pitch": 1, "_playing": false, "_speed": 1, "_volume": 1, "onPlaySubscription": {"remove": [Function remove]}, "registerOnPlay": [Function anonymous]}
如果您只是继续到最后,您将在单击呼叫按钮时看到错误...
ConnectyCube 的示例代码运行良好,但它使用旧的反应导航。以下是 ConnectyCube 示例代码的链接:
https://github.com/ConnectyCube/connectycube-reactnative-samples/tree/master/RNVideoChatConf
我基本上只是使用了最新的反应导航,但其余代码与 connectycube 的示例代码相同,但它的工作方式不同......我得到了反应原生声音错误......