【发布时间】:2017-01-05 12:33:11
【问题描述】:
在最后的 prepareWebrtc 函数中,我有以下代码:
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
);
});
当“video”对于 android 为 true 并且对于 ios 为 video 为{optional: [{sourceId: videoSourceId}] } 时,音频会被传输,但是,我必须请求相机权限,而我不想这样做。当我做“video”:false时,我的应用程序可以接收到音频;但是,它没有被发送。
【问题讨论】:
-
你找到问题了吗?
-
您找到解决方案了吗?
标签: react-native webrtc