JSFiddle - React, Tailwind, and code Playground
by bistri
HTML
<script src="https://api.bistri.com/bistri.conference.min.js"></script>
JavaScript
var room;
var members;
var localStream;
onBistriConferenceReady = function () {
bc.init( {
"appId": "38077edb",
"appKey": "4f304359baa6d0fd1f9106aaeb116f33",
"userId": "20a43d48027e3c6fe7101da1534d5681",
"debug": true
} );
bc.signaling.bind( "onConnected", function () {
bc.startStream( "webcam-sd", function( stream ){
localStream = stream;
bc.attachStream( stream, document.body, { mirror: true } );
//bc.call( "", "uneroom", { "stream": stream } );
} );
} );
bc.signaling.bind( "onError", function ( error ) {
alert( error.text + " (" + error.code + ")" );
} );
bc.signaling.bind( "onJoinedRoom", function ( data ) {
console.log( "join room", data )
} );
bc.signaling.bind( "onJoinRoomError", function ( error ) {
alert( error.text + " (" + error.code + ")" );
} );
bc.signaling.bind( "onPresence", function ( data ) {
console.log( "presence = ", data );
} );
bc.signaling.bind( "onQuittedRoom", function( room ) {
bc.stopStream( localStream, function(){
bc.detachStream( localStream );
} );
} );
bc.streams.bind( "onStreamAdded", function ( remoteStream ) {
bc.attachStream( remoteStream, document.body );
} );
bc.streams.bind( "onStreamClosed", function ( stream ) {
bc.detachStream( stream );
} );
// when a local stream cannot be retrieved
bc.streams.bind( "onStreamError", function( error ){
switch( error.name ){
case "PermissionDeniedError":
alert( "Webcam access has not been allowed" );
bc.quitRoom( room );
break
case "DevicesNotFoundError":
if( confirm( "No webcam/mic found on this machine. Process call anyway ?" ) ){
// show pane with id "pane_2"
showPanel( "pane_2"...