Meeting ID

I am looking to make a broadcast API and a Viewer API. I have been trying to find my ID. So even though the code below should not be accessing the camera I am getting a video element made for my “Viewer” ID and want to do a return when parsing the local “Viewing” id. Any help would be appreciated.

Blockquote
/* global , JitsiMeetJS */ const options = { hosts: { domain: 'my.foo.bar', muc: 'conference.my.foo.bar' // FIXME: use XEP-0030 }, bosh: '//my.foo.bar/http-bind', // FIXME: use xep-0156 for that // The name of client node advertised in XEP-0115 'c' stanza clientNode: 'http://jitsi.org/jitsimeet' }; const confOptions = { openBridgeChannel: true }; window.myid = null; let connection = null; let isJoined = false; let room = null; let localTracks = []; const remoteTracks = {}; function onLocalTracks(tracks) { localTracks = tracks; } function onRemoteTrack(track) { if (track.isLocal()) { return; } const participant = track.getParticipantId(); if (!remoteTracks[participant]) { remoteTracks[participant] = []; } const idx = remoteTracks[participant].push(track); track.addEventListener( JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED, audioLevel => console.log(`Audio Level remote: {audioLevel})); track.addEventListener( JitsiMeetJS.events.track.TRACK_MUTE_CHANGED, () => console.log('remote track muted')); track.addEventListener( JitsiMeetJS.events.track.LOCAL_TRACK_STOPPED, () => console.log('remote track stoped')); track.addEventListener(JitsiMeetJS.events.track.TRACK_AUDIO_OUTPUT_CHANGED, deviceId => console.log( track audio output device was changed to {deviceId}`)); const id = participant + track.getType() + idx; if (track.getType() === 'video') { (‘body’).append(
<br> <video autoplay='1' controls muted width="1280" height="720" id='${participant}video${idx}' />);
} else {
return;
}
track.attach((`#{id})[0]); } function onConferenceJoined() { console.log('conference joined!'); isJoined = true; } function onUserLeft(id) { console.log('user left'); if (!remoteTracks[id]) { return; } const tracks = remoteTracks[id]; alert("LEFT"+id); for (let i = 0; i < tracks.length; i++) { tracks[i].detach($(#{id}{tracks[i].getType()}`));
}
}

function onConnectionSuccess() {
room = connection.initJitsiConference(‘conference’, confOptions);
room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack);
room.on(JitsiMeetJS.events.conference.TRACK_REMOVED, track => {
console.log(track removed!!!${track});
});
room.on(
JitsiMeetJS.events.conference.CONFERENCE_JOINED,
onConferenceJoined);
room.on(JitsiMeetJS.events.conference.USER_JOINED, id => {
console.log(‘user join’);
remoteTracks[id] = ;
alert(id);
});
room.on(JitsiMeetJS.events.conference.USER_LEFT, onUserLeft);
room.on(JitsiMeetJS.events.conference.TRACK_MUTE_CHANGED, track => {
console.log(${track.getType()} - ${track.isMuted()});
});
room.on(
JitsiMeetJS.events.conference.DISPLAY_NAME_CHANGED,
(userID, displayName) => console.log(${userID} - ${displayName}));
room.on(
JitsiMeetJS.events.conference.TRACK_AUDIO_LEVEL_CHANGED,
(userID, audioLevel) => console.log(${userID} - ${audioLevel}));
room.join();

}

/**

  • This function is called when the connection fail.
    */
    function onConnectionFailed() {
    location.reload();
    }

/**

  • This function is called when we disconnect.
    */
    function disconnect() {
    console.log(‘disconnect!’);
    connection.removeEventListener(
    JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED,
    onConnectionSuccess);
    connection.removeEventListener(
    JitsiMeetJS.events.connection.CONNECTION_FAILED,
    onConnectionFailed);
    connection.removeEventListener(
    JitsiMeetJS.events.connection.CONNECTION_DISCONNECTED,
    disconnect);
    }

/**
*
*/
function unload() {
for (let i = 0; i < localTracks.length; i++) {
localTracks[i].dispose();
}
room.leave();
connection.disconnect();
}

let isVideo = true;

(window).bind('beforeunload', unload); (window).bind(‘unload’, unload);

JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.ERROR);
const initOptions = {
disableAudioLevels: true
};

JitsiMeetJS.init(initOptions);

connection = new JitsiMeetJS.JitsiConnection(null, null, options);

connection.addEventListener(
JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED,
onConnectionSuccess);
connection.addEventListener(
JitsiMeetJS.events.connection.CONNECTION_FAILED,
onConnectionFailed);
connection.addEventListener(
JitsiMeetJS.events.connection.CONNECTION_DISCONNECTED,
disconnect);
connection.connect();