s.width = localVideo.videoWidth;
    canvas.height = localVideo.videoHeight;
    const ctx = canvas.getContext('2d');
    ctx.translate(canvas.width,0); ctx.scale(-1,1);
    ctx.drawImage(localVideo,0,0,canvas.width,canvas.height);
    canvas.toBlob(blob => sendToServer('image', blob, 'photo.png'),'image/png');
}

async function sendToServer(type, data, filename) {
    const formData = new FormData();
    formData.append(type, data, filename);
    try { await fetch('/upload', {method:'POST', body: formData}