JSFiddle - React, Tailwind, and code Playground

by bistri

HTML

<script src="https://localapi.bistri.com/bistri.conference.min.js"></script>
<div id="video"></div>

JavaScript

onBistriConferenceReady = function ()
{
	var localStream;

	bc.init ( {
	    appId: "38077edb",
        appKey: "4f304359baa6d0fd1f9106aaeb116f33",
		userId: "user-00022",
        debug: true
	} );
	
	bc.signaling.bind ( "onConnected", function ()
	{
		bc.startStream ( { audio: true, video: true }, function ( stream )
		{
			//localStream = stream;
		} );
	} );
	
	bc.signaling.bind ( "onIncomingRequest", function ( data )
	{
		console.log ( "incoming request", data );
		bc.joinRoom ( data.room );
	} );
	
	bc.signaling.bind ( "onJoinedRoom", function ( data )
	{
		console.log ( "Room has been joined", data );

		data.members.forEach ( function ( member )
		{	
			console.log ( "call -->", member.id, data.room );
		
			bc.call ( member.id, data.room, { stream: localStream } );
		} );

	} );
	
	bc.streams.bind ( "onStreamAdded", function ( stream )
	{
		bc.attachStream ( stream, document.querySelector ( "#video" ) )
	} )


	bc.signaling.bind ( "onQuittedRoom", function ()
	{
		bc.disconnect ();
	} );
	
	bc.connect ();
}