Skip to content
Snippets Groups Projects
Commit b50cd63d authored by Neil Gershenfeld's avatar Neil Gershenfeld
Browse files

new video call

parent ec6e1a70
No related branches found
No related tags found
No related merge requests found
...@@ -146,25 +146,19 @@ function start_video() { ...@@ -146,25 +146,19 @@ function start_video() {
var ctx = mod.img.getContext("2d") var ctx = mod.img.getContext("2d")
ctx.canvas.width = w ctx.canvas.width = w
ctx.canvas.height = h ctx.canvas.height = h
navigator.getMedia = ( var constraints = {
navigator.getUserMedia || audio:false,
navigator.webkitGetUserMedia || video:{width:w,height:h}
navigator.mozGetUserMedia || }
navigator.msGetUserMedia) navigator.mediaDevices.getUserMedia(constraints)
navigator.getMedia( .then(function(stream) {
{video:true,audio:false}, mod.video.srcObject = stream
function(stream) { mod.video.onloadedmetadata = function(e) {
var vendorURL = window.URL || window.webkitURL
mod.video.src = vendorURL.createObjectURL(stream)
mod.video.play() mod.video.play()
}, }
function(err) {console.log("video startup error")} })
) .catch(function(err) {
mod.video.addEventListener('canplay', console.log(err.name + ": "+err.message)
function(evt) {
mod.video.setAttribute('width',w)
mod.video.setAttribute('height',h)
capture_video()
}) })
} }
function update_video() { function update_video() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment