Simple WebRTC Video Conference

Build on top of Bistri WebRTC API. https://api.developers.bistri.com/tutorial

HTML

<script src="https://api.bistri.com/bistri.conference.min.js"></script>
<div>
    <input type="button" value="Join Conference" onclick="joinRoom();" class="join" \>
    <input type="button" value="Quit Conference" onclick="quitRoom();" class="quit" \>
</div>
<div class="video-container"></div>

CSS

.join {
    display: inline;
}
.quit {
    display: none;
}
video {
    float left;
    margin: 10px;
    width: 300px;
}

JavaScript

/*
 * Need some explanations about this code ?
 * Take a look at our API tutorial:
 * http://developers.bistri.com/webrtc-sdk/javascript-library-tutorial
 * JS library reference:
 * http://developers.bistri.com/webrtc-sdk/js-library-reference
 */

onBistriConferenceReady = function () {
  
    var room = "myMeetingRoom";

    // at first we test if the browser is WebRTC enable
    if (!bc.isCompatible()) {
        alert("your browser is not WebRTC compatible !");
        return;
    }

    window.localStream;

    /*
     * this is the function called when the button "Join Conference" is pressed
     */
    window.joinRoom = function () {

        // if the local stream (webcam) is ready 
        if (!window.localStream) {
            alert("local media is not ready");
            return;
        }

        // then when are ready to join the conference room called "myMeetingRoom" and set the room "capacity" to 3 participants
        bc.joinRoom(room,3);
    };

    /*
     * this is the function called when the button "Quit Conference" is pressed
     */
    window.quitRoom = function () {

        // We stop calls with all conference room members
        bc.endCalls(room);

        // then we quit the conference room
        bc.quitRoom(room);
    };

    /*
     * API is initialized with personal keys
     * To get your own keys, go to https://api.developers.bistri.com/login
     * debug is set to true to print some logs in the javascript console
     */
    bc.init({
        // don't forget to replace the following keys by your own
        appId: "38077edb",
        appKey: "4f304359baa6d0fd1f9106aaeb116f33",
        debug: true
    });

    /*
     * we add a handler to manage "onConnected" event triggered by the signaling server
     * this event occurs when user is connected to the signaling server
     */
    bc.signaling.bind("onConnected", function () {
         
        // we are now connected to the signaling server, 
        // we can request access...