$ git clone https://ion.nu/git/webchat
commit 11068c57fdd302a1ee3183ff2d651fe9d68a8f2c
Author: Alicia <...>
Date: Tue Dec 29 02:29:38 2015 +0100
Restrict the video bitrate in MediaRecorder to 32kbps (though everything but the latest firefox will ignore this at the moment)
diff --git a/cams.js b/cams.js
index cc972a8..1c38c99 100644
--- a/cams.js
+++ b/cams.js
@@ -45,7 +45,6 @@ function broadcast()
}
if(!broadcasting)
{
-// TODO: Try to constrain video to a low enough resolution for shit connections
navigator.getUserMedia({video:true, audio:true}, broadcast_success, function(e){alert('getUserMedia failed (is your camera connected?)'); usermediaerror=e;});
}else{
broadcasting=false;
@@ -79,7 +78,7 @@ function broadcast_success(stream)
document.getElementById('cams').appendChild(mycam.video);
cams.push(mycam);
// Streaming to the server
- mediarec=new MediaRecorder(stream);
+ mediarec=new MediaRecorder(stream, {videoBitsPerSecond:32000});
mediarec.ondataavailable=function(data)
{
if(data.data.size==0){return;} // Don't send 0-byte data