switching multiple streams problem

55 views
Skip to first unread message

Hakan Pekdemir

unread,
Apr 13, 2018, 5:04:54 AM4/13/18
to EasyRTC
Hi,

I am working on a project that broadcasts multiple security cameras using EasyRTC, i want to see only one camera at a time on the owner side and switch the remote streams by requesting the stream name to host. However, when i hangup and send a new call to host (to switch streams), it does not trigger the streamAcceptor of my peer. My recall action:

button.onclick = function() {
    //hangup first
    easyrtc.hangupAll();

    selectedRemoteStream = this.innerHTML;//stream name from button text
    //send stream name to otherEasyrtcid
    easyrtc.sendData(otherEasyrtcid, "setStream",  selectedRemoteStream,
        function(ackMsg){
            console.log("setStream acknowledgment " + JSON.stringify(ackMsg));
            
        }
    );
    //call otherEasyrtcid
    performReCall(otherEasyrtcid);

}

It first hangs up, then sends requested stream name by messaging and tries to call again.
My acceptchecker on the host:

easyrtc.setAcceptChecker(function(easyrtcid, callback) {
    console.log("stream accepted");
    otherEasyrtcid = easyrtcid;

        if(ownerStreams[otherEasyrtcid] == null)
    {
        ownerStreams[otherEasyrtcid] = 'Camera: 1';
    }

    callback(true);
    if( otherEasyrtcid) {
        console.log("add stream to call");
        easyrtc.addStreamToCall(otherEasyrtcid, ownerStreams[otherEasyrtcid], function(easyrtcid, streamName){
            console.log("other party " + easyrtcid + " acknowledges receiving " + streamName);
        });
    }
});

Am i doing something wrong here or should i follow another approach?
Thanks

Hakan Pekdemir

unread,
Apr 19, 2018, 3:25:53 AM4/19/18
to EasyRTC
I have found the problem, it is my bug :)
When I fill my stream name list ownerStreams[], I mistakenly stringify an existing string. Thus it puts ( " ) characters to stream name like "\"Camera: 1\"". 
However, addStreamToCall function or any other functions did not raise an error. May be it should say, there is no local stream with this name.

Thanks
Reply all
Reply to author
Forward
0 new messages