function addVideoStream(video, stream, name) {
	video.srcObject = stream;
	video.addEventListener("loadedmetadata", () => {
		video.play();
	});

	//generate nametags
	const container = document.createElement('div');
	const nametag = document.createElement('span');
	nametag.innerHTML = name;
	container.append(nametag);
	container.append(video);

	videoGrid.append(container);

	//clean up some randomly placed nodes
	videoGrid.childNodes.forEach((currentValue) => {
		if (currentValue.childElementCount < 2) {
			currentValue.outerHTML = "";
		}
	});
}
//add the video stream to the DOM
add the video stream to the DOM
add the video stream to the DOM
function addVideoStream(video, stream, name) {
	video.srcObject = stream;
	video.addEventListener("loadedmetadata", () => {
		video.play();
	});
	const container = document.createElement('div');
	const nametag = document.createElement('span');
	nametag.innerHTML = name;
	container.append(nametag);
	container.append(video);
	videoGrid.append(container);
	videoGrid.childNodes.forEach((currentValue) => {
		if (currentValue.childElementCount < 2) {
			currentValue.outerHTML = "";
		}
	});
}
function addVideoStream ( video , stream , name ) { video . srcObject = stream ; video . addEventListener ( "loadedmetadata" , ( ) => { video . play ( ) ; } ) ; const container = document . createElement ( 'div' ) ; const nametag = document . createElement ( 'span' ) ; nametag . innerHTML = name ; container . append ( nametag ) ; container . append ( video ) ; videoGrid . append ( container ) ; videoGrid . childNodes . forEach ( ( currentValue ) => { if ( currentValue . childElementCount < 2 ) { currentValue . outerHTML = "" ; } } ) ; }
add the video stream to the DOM
add the video stream to the DOM
//generate nametags //clean up some randomly placed nodes