相关疑难解决方法(0)

WebRTC远程视频显示为黑色

在开发WebRTC视频聊天应用程序时,我遇到了远程接收视频流.收到视频流blob,但视频只是黑色.

我已经完成了这些答案,并尝试了几乎所有我能做到的工作 /sf/answers/1219695711/ 远程VideoStream无法使用WebRTC

......
Globalvars.socket.on('call', function (signal) {
    if(!Globalvars.pc){
        Methods.startCall(false, signal);
    }

    if(signal.sdp){
        temp = new RTCSessionDescription({"sdp" : decodeURIComponent(signal.sdp), "type" : signal.type});
        Globalvars.pc.setRemoteDescription(temp);
        for(i = 0; i < Globalvars.iceCandidateArray.length; i++){
            Globalvars.pc.addIceCandidate(new RTCIceCandidate({
                sdpMLineIndex: decodeURIComponent(signal.sdpMLineIndex),
                candidate: decodeURIComponent(signal.candidate)
            }));
        }

        Globalvars.iceCandidateArray = [];
    }
    else{
        if(Globalvars.pc.remoteDescription){
            Globalvars.pc.addIceCandidate(new RTCIceCandidate({
                sdpMLineIndex: decodeURIComponent(signal.sdpMLineIndex),
                candidate: decodeURIComponent(signal.candidate)
            }));
            console.log("remot");
        }
        else{
            Globalvars.iceCandidateArray.push(new RTCIceCandidate({
                sdpMLineIndex: decodeURIComponent(signal.sdpMLineIndex),
                candidate: decodeURIComponent(signal.candidate)
            }));
            console.log("ice candidate to temp array");
        }
    }
});


$("#roster-wrap").on("click", ".roster-list-item", function(e){
    //Globalvars.socket.emit('call', {"receiver_id" : $(this).attr("data-id"), "caller_id" : Globalvars.me.id}); …
Run Code Online (Sandbox Code Playgroud)

javascript html5 webrtc

36
推荐指数
1
解决办法
3384
查看次数

peerConnection.addIceCandidate给出错误:无效的字符串

我正在尝试实现仅限语音的WebRTC应用.我在Chrome上运行它Version 29.0.1547.0 dev.我的应用程序使用Socket.IO作为信令机制.

peerConnection.addIceCandidate() 给我这个错误: Uncaught SyntaxError: An invalid or illegal string was specified.

和另外,peerConnection.setRemoteDescription();给我这个错误:Uncaught TypeMismatchError: The type of an object was incompatible with the expected type of the parameter associated to the object.

这是我的代码:

SERVER(在CoffeeScript中)

app = require("express")()
server = require("http").createServer(app).listen(3000)
io = require("socket.io").listen(server)

app.get "/", (req, res) -> res.sendfile("index.html")
app.get "/client.js", (req, res) -> res.sendfile("client.js")

io.sockets.on "connection", (socket) ->
    socket.on "message", (data) ->
        socket.broadcast.emit "message", data
Run Code Online (Sandbox Code Playgroud)

CLIENT(用JavaScript)

var socket = io.connect("http://localhost:3000"); …
Run Code Online (Sandbox Code Playgroud)

html5 websocket node.js socket.io webrtc

5
推荐指数
1
解决办法
4467
查看次数

标签 统计

html5 ×2

webrtc ×2

javascript ×1

node.js ×1

socket.io ×1

websocket ×1