Skip to content

Instantly share code, notes, and snippets.

@kwindla
Created March 10, 2019 21:59
Show Gist options
  • Save kwindla/007eecb5ff8ac1d761974b2cb93552f3 to your computer and use it in GitHub Desktop.
Save kwindla/007eecb5ff8ac1d761974b2cb93552f3 to your computer and use it in GitHub Desktop.
modified startCall() - create a new room only if we aren't passed a callUrl argument
const createRoomEndpoint = 'https://create-a-room--kwindla.repl.co';
async function startCall(callUrl) {
if (!callUrl) {
let response = await fetch(createRoomEndpoint),
roomData = await response.json();
callUrl = roomData.url;
}
let iframeEl = document.createElement('iframe');
iframeEl.width = 350;
iframeEl.height = 425;
iframeEl.style.position = 'absolute';
iframeEl.style.right = '1em';
iframeEl.style.bottom = '3em';
iframeEl.src = callUrl;
iframeEl.allow="camera; microphone; autoplay";
document.body.appendChild(iframeEl);
window.location = '#' + callUrl
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment