Previewing the local video streams
To preview the local video streams, we implement the
setup_video()
function. This requests access to the local camera's video stream using the getUserMedia
call.
If this stream is set up successfully, then it is displayed on the local browser page in the <video>
media element with the local_video
ID using the connect_stream_to_src()
function defined in webrtc_polyfill.js
.
If this local stream is not set up successfully, then the error is logged so the user can be notified.
// setup stream from the local camera function setup_video() { get_user_media( { "audio": true, // request access to local microphone "video": true // request access to local camera }, function (local_stream) { // success callback // preview the local camera & microphone stream connect_stream_to_src( local_stream, document.getElemntById("local_video") ); ... }, log_error // error callback ); }
It is important...