↑ WEBRTC EXPERIMENTS

# Manual session establishment + extra data transmission + video conferencing

Copyright © Muaz Khan <@muazkh >.

> This demo is out-dated i.e. deprecated (written in 2013).
> Please try other demos: https://github.com/muaz-khan/RTCMultiConnection

## New Session:

## Local video container | ## Remote videos container

## Go ahead and try!

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

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

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; } };

## Feedback