diff --git a/dist/infragram2.js b/dist/infragram2.js index 5519a959..979cb7a0 100644 --- a/dist/infragram2.js +++ b/dist/infragram2.js @@ -131,7 +131,17 @@ function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else i if (image) options.run(options.mode); options.camera.getSnapshot(); //if (options.colorized) return options.colorize(); }, interval); - }; // TODO: this doesn't work; it just downloads the unmodified image. + }; + + options.processLocalVideo = function processLocalVideo() { + options.camera.unInitialize(); + var interval; + if (options.processor.type == "webgl") interval = 15;else interval = 150; + setInterval(function () { + if (image) options.run(options.mode); + options.camera.getSnapshot(); //if (options.colorized) return options.colorize(); + }, interval); + }; // TODO: this doesn't work; it just downloads the unmodified image. // probably a timing issue? @@ -412,6 +422,11 @@ function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else i $("#snapshot").show(); $("#live-video").show(); $("#webcam").show(); + } + + function unInitialize() { + //Initialize Webrtc without webcam + getUserMedia(webRtcOptions, falseSuccess, deviceError); } // webRtcOptions contains the configuration information for the shim // it allows us to specify the width and height of the video // output we"re working with, the location of the fallback swf, @@ -422,7 +437,7 @@ function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else i var webRtcOptions = options.webRtcOptions || { "audio": false, "video": true, - // the element (by id) you wish to use for + // the element (by id) you wish to use for // displaying the stream from a camera el: "webcam", extern: null, @@ -431,8 +446,8 @@ function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else i // container width: 640, height: 480, - // the recommended mode to be used is - // "callback " where a callback is executed + // the recommended mode to be used is + // "callback " where a callback is executed // once data is available mode: "callback", // a debugger callback is available if needed @@ -481,6 +496,7 @@ function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else i function success(stream) { var video; window.localStream = stream; + isOnCam = stream; isCamera = true; if (webRtcOptions.context === "webrtc") { @@ -502,13 +518,18 @@ function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else i alert("No camera available."); console.log(error); return console.error("An error occurred: [CODE " + error.code + "]"); + } + + function falseSuccess(stream) { + //Prevent Webcam stream during video processing + stream.getVideoTracks()[0].stop(); } // not doing anything now... for copying to a 2nd canvas function getSnapshot() { var video; // If the current context is WebRTC/getUserMedia (something // passed back from the shim to avoid doing further feature - // detection), we handle getting video/images for our canvas + // detection), we handle getting video/images for our canvas // from our HTML5