diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cf3de57 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.AppleDouble +:* + + diff --git a/jquery.webcam.js b/jquery.webcam.js index fea1c38..f0d7709 100644 --- a/jquery.webcam.js +++ b/jquery.webcam.js @@ -19,6 +19,8 @@ width: 320, height: 240, + objectWidth: 320, + objectHeight: 240, mode: "callback", // callback | save | stream @@ -44,7 +46,7 @@ } } - var source = ''; + var source = ''; if (null !== webcam.extern) { $(webcam.extern)[webcam.append ? "append" : "html"](source); diff --git a/jscam.swf b/jscam.swf index 7cbd2ef..358f714 100644 Binary files a/jscam.swf and b/jscam.swf differ diff --git a/src/jscam.as b/src/jscam.as index 9242344..c4d0d29 100644 --- a/src/jscam.as +++ b/src/jscam.as @@ -18,6 +18,7 @@ import JPGEncoder; class JSCam { private static var camera:Camera = null; + private static var display:MovieClip = null; private static var buffer:BitmapData = null; private static var quality:Number = 85; private static var interval = null; @@ -57,30 +58,28 @@ class JSCam { // http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary133.html camera.onStatus = function(info:Object) { - switch (info.code) { - case 'Camera.Muted': - ExternalInterface.call('webcam.debug', "notify", "Camera stopped"); - break; + switch (info.code) { + case 'Camera.Muted': + ExternalInterface.call('webcam.debug', "notify", "Camera stopped"); + break; case 'Camera.Unmuted' : - ExternalInterface.call('webcam.debug', "notify", "Camera started"); - break; - } + ExternalInterface.call('webcam.debug', "notify", "Camera started"); + break; + } } camera.setQuality(0, 100); camera.setMode(Stage.width, Stage.height, 24, false); ExternalInterface.addCallback("capture", null, capture); - ExternalInterface.addCallback("save", null, save); - ExternalInterface.addCallback("setCamera", null, setCamera); ExternalInterface.addCallback("getCameraList", null, getCameraList); - _root.attachMovie("clip", "video", 1); - _root.video.attachVideo(camera); - _root.video._x = 0; - _root.video._y = 0; + display = _root.attachMovie("clip", "video", 1); + display.video._x = 0; + display.video._y = 0; + display.video.attachVideo(camera); } else { ExternalInterface.call('webcam.debug', "error", "No camera was detected."); @@ -123,7 +122,7 @@ class JSCam { } if (0 == time) { - buffer.draw(_root.video); + buffer.draw(display.video); ExternalInterface.call('webcam.onCapture'); ExternalInterface.call('webcam.debug', "notify", "Capturing finished."); } else { @@ -133,7 +132,6 @@ class JSCam { } public static function getCameraList():Array { - var list = new Array(); for (var i = 0, l = Camera.names.length; i < l; i++) { @@ -163,10 +161,10 @@ class JSCam { if ("callback" == mode) { - for (var i = 0; i < 240; ++i) { + for (var i = 0; i < 640; ++i) { var row = ""; - for (var j=0; j < 320; ++j) { + for (var j=0; j < 480; ++j) { row+= buffer.getPixel(j, i); row+= ";"; } @@ -213,17 +211,17 @@ class JSCam { private static function _stream():Void { - buffer.draw(_root.video); + buffer.draw(display.video); if (null != stream) { clearInterval(stream); } - for (var i = 0; i < 240; ++i) { + for (var i = 0; i < 640; ++i) { var row = ""; - for (var j=0; j < 320; ++j) { + for (var j=0; j < 480; ++j) { row+= buffer.getPixel(j, i); row+= ";"; } diff --git a/src/jscam.xml b/src/jscam.xml index a0734a0..0b3cb71 100644 --- a/src/jscam.xml +++ b/src/jscam.xml @@ -1,11 +1,12 @@ - - - - + - + + + -