音频不发送react-native-webrtc

时间:2017-01-05 12:33:12

标签: react-native webrtc

在最后的prepareWebrtc函数中,我有以下代码:

200 :  OK

<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Thu Jan 05 17:51:57 IST 2017</div><div>There was an unexpected error (type=Internal Server Error, status=500).</div><div>${message}</div></body></html>

当“视频”对于Android是真的,当视频为MediaStreamTrack.getSources(sourceInfos => { var isFront = camera_front console.log(sourceInfos); let videoSourceId; for (const i = 0; i < sourceInfos.length; i++) { const sourceInfo = sourceInfos[i]; if(sourceInfo.kind == "video" && sourceInfo.facing == (isFront ? "front" : "back")) { videoSourceId = sourceInfo.id; } } console.log("videoSourceId:" + videoSourceId) getUserMedia({ "audio": true, "video":false }, (stream) => { streamsDone(handleId, jsep, media, callbacks, stream) }, // TODO: add error handling () => undefined ); }); 的ios时,音频会被传输,但是,我必须要求相机权限,我不想这样做。当我做“视频”:假,我的应用程序可以收到音频;但是,它没有发送。

1 个答案:

答案 0 :(得分:0)

首先检查androidmanifest.xml中的权限。下面的权限应该在那里。

    <uses-permission android:name="android.permission.MICROPHONE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

接下来检查您要发送的候选数据,其中应包含 "sdpMid": "audio"

现在,如果音频仍然不存在,则可能是由于react-native-webrtc正在耳机上播放音频以将其更改为扬声器使用https://github.com/react-native-webrtc/react-native-incall-manager