Javascript webrtc每对每视频聊天,但只需要一方向另一方发送视频

Javascript webrtc每对每视频聊天,但只需要一方向另一方发送视频,javascript,video-streaming,webrtc,simplewebrtc,Javascript,Video Streaming,Webrtc,Simplewebrtc,我读了很多关于webrtc的例子,但我不明白如何在a和B之间通过p2p聊天视频,而只需要a使用p2p连接将流视频发送到B,如何做到这一点? 我曾尝试在B{video:false}中禁用视频本地,但出现错误,无法工作 我的脚本 var webrtc=新的SimpleWebRTC({ //将保存“我们的”视频的id/element dom元素 localVideoEl:“localVideo”, //将保存远程视频的id/element dom元素 remoteVideosEl:“remotes

我读了很多关于webrtc的例子,但我不明白如何在a和B之间通过p2p聊天视频,而只需要a使用p2p连接将流视频发送到B,如何做到这一点? 我曾尝试在B{video:false}中禁用视频本地,但出现错误,无法工作

我的脚本


var webrtc=新的SimpleWebRTC({
//将保存“我们的”视频的id/element dom元素
localVideoEl:“localVideo”,
//将保存远程视频的id/element dom元素
remoteVideosEl:“remotesVideos”,
//立即要求进入摄像机
autoRequestMedia:没错,
//https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
//https://github.com/andyet/signalmaster/blob/master/README.md
媒体:{
音频:错,
视频:{
//宽度:720,
宽度:{理想值:640},
//身高:1280,
高度:{理想值:480},
帧率:{理想值:15}
}
},
接收媒体:{
offerToReceiveAudio:0,
offerToReceiveVideo:1
}
});
//我们必须等到它准备好
webrtc.on('readyToCall',函数(){
//你可以给它起任何名字
webrtc.joinRoom(“寨卡ghe vl”);
});

在发送方启用视频,禁用音频。在接收器上禁用这两个选项。 试试下面的代码

<!DOCTYPE html>
<html>
    <head>
        <script src="https://simplewebrtc.com/latest-v2.js"></script>
         <button onclick="start(false)">Receive video</button>
          <button onclick="start(true)"">Send video</button>
        <script type="text/javascript">
            function start (e) {

                /**
                    have separate settings to get the trigger form UI
                */
                var videoSettings = {
                            //width: 720,
                            width: {ideal: 640},
                            // height: 1280,
                            height: {ideal: 480},
                            frameRate: {ideal: 15}
                        }
                if(!e) videoSettings = e;
                new SimpleWebRTC({
                // the id/element dom element that will hold "our" video

                    localVideoEl: 'localVideo',

                    // the id/element dom element that will hold remote videos
                    remoteVideosEl: 'remotesVideos',
                    // immediately ask for camera access
                    autoRequestMedia: true,
                    //https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
                    //https://github.com/andyet/signalmaster/blob/master/README.md
                    media: {
                            audio: false,
                            video: videoSettings
                    },
                    receiveMedia: {
                        offerToReceiveAudio: 0,
                        offerToReceiveVideo: 1
                    }
                }).on('readyToCall', function () {
                    // you can name it anything
                    this.joinRoom('zika ghe vl');
                });
            }    

        </script>
    </head>
    <body>
        <div id="remotesVideos"></div>
    </body>
</html>

接收视频

你能包括你在问题中尝试过的
javascript
吗?不,不,我只想从A到B发送视频直播流,从A到B只发送一个方向,不需要音频。你能做到吗?(通过p2p连接一对一)非常感谢,这么简单,但我以前听不懂^^