Calling from setRoomOccupantListener function.

227 views
Skip to first unread message

Emilio López

unread,
Jan 28, 2014, 2:51:54 PM1/28/14
to eas...@googlegroups.com
Hi! I'm new to easyRTC and this forum so sorry if this question doesn't belong here.

I'm making an app that has two kind of rooms. A "waiting room" where you can establish p2p connections with other users (already got working) and multiparty rooms where you connect with every user connected to that group. I want it to be automatic so when you access a room the app calls all the other users for you, without having to push anything. FIrst I implemented it with a button you can click and it calls everyone in the rooms and it works fine but it is not working if in my function for setRoomOccupantListener I put something like


        for(var i in data) {
           
var listItem = document.createElement('li');
            listItem
.innerHTML = easyrtc.idToName(i);
            listElement
.appendChild(listItem);
            listSize
= listSize + 1;
           
//to avoid calling someone I'm already talking to and
           
//to avoid users from calling each other at the same time
           
if(easyrtc.getSlotOfCaller(i) == -1 && i < selfEasyrtcid) {
                performCall
(i);
           
}
       
}

(data is the list of users connected to the room). The function performCall is the one I use for calling users in other moments and it works perfectly fine (I use easyrtc.call in it). The function is being called nevertheless the call is not being made.

I'll be happy to provide some more information if you can help me. Thank you very much,

Emilio.

Eric Davies

unread,
Jan 28, 2014, 3:51:06 PM1/28/14
to eas...@googlegroups.com
I don't see any flaws in the logic you've posted, suggesting it may be somewhere else in your code.
I'd have to see more. 
Eric.

Emilio López

unread,
Jan 29, 2014, 7:02:35 AM1/29/14
to eas...@googlegroups.com
I kept trying and discovered that it influences to have easyrtc.enabledebug(true). I cannot provide the code right now (was told to provide it only if I was desperate) but you can use the demo "Simple Video+Audio Demo" that comes with the server example. Change converListToButtons for the following

function convertListToButtons (roomName, data, isPrimary) {
    clearConnectList
();
   
var otherClientDiv = document.getElementById('otherClients');
   
for(var easyrtcid in data) {
       
var button = document.createElement('button');
        button
.onclick = function(easyrtcid) {
           
return function() {
                performCall
(easyrtcid);
           
};
       
}(easyrtcid);
       
if(easyrtc.getSlotOfCaller(easyrtcid) == -1 && easyrtcid < selfEasyrtcid) {
            performCall
(easyrtcid);
       
}




       
var label = document.createTextNode(easyrtc.idToName(easyrtcid));
        button
.appendChild(label);
        otherClientDiv
.appendChild(button);
   
}
}

It should call automatically as soon as you connect two users to the same server right? Nope. UNLESS you use easyrtc.enableDebug(true).
Now I'm having other issues but I believe they might be related with my logic and not with the library. I'll update if I have any news, thank you.

Emilio.

Eric Davies

unread,
Jan 31, 2014, 4:40:43 PM1/31/14
to eas...@googlegroups.com
I tried pasting your code in. It auto-called just fine.

That said, I did run into a problem: my browser was initially getting an old copy of the javascript and the html, presumably cached someplace. I had to use a different server directory, simply restarting the server and clear browser caches didn't do anything useful. I'll have to ask Rod about that sometime, but in the meantime, when you start up your application, use the source tab to examine the javascript for your function to make sure it's the code you expect to see.

Eric.

Emilio López

unread,
Jan 31, 2014, 4:47:05 PM1/31/14
to eas...@googlegroups.com
Hey Eric thanks for your answer. I did check the version every time I was running the app and made sure it was the latest one. I still have the issue that it won't work if I disable debugging. I don't know if it has any influence but I use Google Chrome 32.0.1700.77 to test the app.

Thank you,

Emilio.

Eric Davies

unread,
Jan 31, 2014, 6:26:44 PM1/31/14
to eas...@googlegroups.com
Thought: use the latest beta release and see if that gives you a different result, though it shouldn't.

Failing that, if you put a piece of demonstrating code on a public site (ie, one I can access), I'll look into it.

Eric.

Reply all
Reply to author
Forward
0 new messages