One-Way Video Broadcast + Audio Feedback: Broadcaster
HTML
<script src="https://api.bistri.com/bistri.conference.min.js"></script>
JavaScript
/*
One-Way Video Broadcast + Audio Feedback Demo: Broadcaster.
the viewer demo is located at the following url:
http://jsfiddle.net/bistri/72ny0xgo
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: "38077edb",
appKey: "4f304359baa6d0fd1f9106aaeb116f33"
} );
// 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( "screen-sharing", 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, { "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, { "stream": localStream } );
} );
// when user is connected to the server
bc.signaling.bind( "onConnected", function () {
...