One-Way Broadcast: Broadcaster

HTML

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

JavaScript

/*
    One-Way Broadcast Demo: Broadcaster.
    the viewer demo is located at the following url:
    http://jsfiddle.net/bistri/ouL2kvgb
    JS library reference:
    http://developers.bistri.com/webrtc-sdk/js-library-reference
*/
onBistriConferenceReady = function () {
    
    var localStream;
  
    // initialize API client with application keys
    // if you don't have your own, you can get them at:
    // https://api.developers.bistri.com/login
    bc.init( {
        appId: "3a9ad2c8",
        appKey: "93fcb9c8e5cbad9f469d9159248e62c4"
    } );

    // when the user has joined a room
    bc.signaling.bind( "onJoinedRoom", function ( data ) {
        var members = data.members;
        // ask the user to access to his webcam and set the resolution to 640x480
        bc.startStream( "640x480", function( stream ){
            localStream = stream;
            // insert the local webcam stream into the page body, mirror option flip the video on vertical axis
            bc.attachStream( localStream, document.body, { "mirror": true } );
             // then, for every single member already present in the room ...
            members.forEach( function( member ){
                // ... request a call
                // "sendonly" option is used to broadcast the stream in one-way
                // "stream" option allow to explicitly defines the stream to use
                bc.call( member.id, data.room, { "sendonly": true, "stream": localStream } );
            } )
        } );
    } );
    
    // when a remote user has joined a room
    bc.signaling.bind( "onPeerJoinedRoom", function ( member ) {
        // request a call
        // "sendonly" option is used to broadcast the stream in one-way
        // "stream" option allow to explicitly defines the stream to use
        bc.call( member.pid, member.room, { "sendonly": true, "stream": localStream } );
    } );
    
    // when user is connected to the server
    bc.signaling.bind( "onConnected", function () {
  ...