↑ WEBRTC EXPERIMENTS

Users ejection and presence detection

Copyright © 2013 Muaz Khan<@muazkh>.

New Session:

Local video container

Remote videos container



Go ahead and try RTCMultiConnection!

Pass "session-id" only-over the constructor:

var connection = new RTCMultiConnection('session-id');

Use "onleave" to be get alerted if a user manually or automatically leaves you:

connection.onleave = function(userid) { };

Eject a user or close entire session:

connection.eject(userid); // throw a user out of your room!
connection.leave();       // close your own entire session

When calling "open" method; pass an argument like this:

connection.open({
    // "extra" object allows you pass extra data like username, number of participants etc.
    extra: {
        boolean: true,
        integer: 0123456789,
        array: [],
        object: {}
    },

    // it is the broadcasting interval — default value is 3 seconds
    interval: 3000
});

Use "onNewSession" method to show each new session in a list so end users can manually join any session they prefer:

connection.onNewSession = function(session) {
    // use "session.extra" to access "extra" data
};

To manually join a preferred session any time; use "join" method instead of "connect" method:

connection.join(session, extra);

// e.g. string
connection.join(session, 'username');

// e.g. object
connection.join(session, {
    username: 'mine user name'
});

"extra" data can be accessed using "connection.onstream" method:

connection.onstream = function(stream){
    var video = stream.mediaElement;

    // it is extra data passed from remote peer
    if(stream.type === 'remote') {
        var extra = stream.extra;
        video.poster = extra.username;
		
        // stream.userid ---- this user-id can be used to eject any user when "onleave" fires
    }
};


What is RTCMultiConnection?



RTCMultiConnection.js a javascript library supports features like audio/video conferencing; (one-way and one-to-many) broadcasting; screen sharing; data/text/file sharing (of any size); multi-and-manual sessions establishment; users ejection, rejection and presence detection; and more. It automatically keeps session "active" all the time; even if initiator leaves.

Feedback