POC Relay: user A

by bistri

HTML

<script src="https://api.bistri.com/bistri.conference.min.js"></script>

JavaScript

onBistriConferenceReady = function () {

    bc.init( {
        "appId": "38077edb",
        "appKey": "4f304359baa6d0fd1f9106aaeb116f33",
        "debug": true
    } );
    
    bc.signaling.bind( "onConnected", function () {
        bc.joinRoom( "relay" );
    } );

    bc.signaling.bind( "onError", function ( error ) {
        alert( error.text + " (" + error.code + ")" );
    } );

    bc.signaling.bind( "onJoinedRoom", function ( data ) {
        bc.startStream( "640x480", function( stream ){
            data.members.forEach( function( member ){
                bc.call( member.id, data.room, { "stream": stream, "sendonly": true } );
            } );
        } );
    } );

    bc.streams.bind( "onStreamAdded", function ( remoteStream ) {
        bc.attachStream( remoteStream, document.body );
    } );
 
    bc.streams.bind( "onStreamClosed", function ( stream ) {
        bc.detachStream( stream );
    } );

    bc.connect();
}