Commit 7fbd47ce by Julia Hansbrough

Merge pull request #1662 from edx/flowerhack/fix/flash-camera-authorization

Fixed bug where Flash photo taker would fail
parents 64c0a8c9 45e80f7e
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
* assign this return value to an img's src attribute. * assign this return value to an img's src attribute.
* reset() restarts the the video. * reset() restarts the the video.
* imageDataUrl() returns the same thing as snap() -- * imageDataUrl() returns the same thing as snap() --
*
* Note that this file is merely the source code for CameraCapture.swf; to make
* changes, you must edit this file, compile it to .swf, and check in the .swf
* file separately
*/ */
package package
...@@ -18,7 +22,6 @@ package ...@@ -18,7 +22,6 @@ package
import flash.display.PNGEncoderOptions; import flash.display.PNGEncoderOptions;
import flash.display.Sprite; import flash.display.Sprite;
import flash.events.Event; import flash.events.Event;
import flash.events.StatusEvent;
import flash.external.ExternalInterface; import flash.external.ExternalInterface;
import flash.geom.Rectangle; import flash.geom.Rectangle;
import flash.media.Camera; import flash.media.Camera;
...@@ -37,7 +40,6 @@ package ...@@ -37,7 +40,6 @@ package
private var camera:Camera; private var camera:Camera;
private var video:Video; private var video:Video;
private var b64EncodedImage:String = null; private var b64EncodedImage:String = null;
private var permissionGiven:Boolean = false;
public function CameraCapture() public function CameraCapture()
{ {
...@@ -47,7 +49,6 @@ package ...@@ -47,7 +49,6 @@ package
protected function init(e:Event):void { protected function init(e:Event):void {
camera = Camera.getCamera(); camera = Camera.getCamera();
camera.setMode(VIDEO_WIDTH, VIDEO_HEIGHT, 30); camera.setMode(VIDEO_WIDTH, VIDEO_HEIGHT, 30);
camera.addEventListener(StatusEvent.STATUS, statusHandler);
video = new Video(VIDEO_WIDTH, VIDEO_HEIGHT); video = new Video(VIDEO_WIDTH, VIDEO_HEIGHT);
video.attachCamera(camera); video.attachCamera(camera);
...@@ -106,26 +107,12 @@ package ...@@ -106,26 +107,12 @@ package
} }
public function cameraAuthorized():Boolean { public function cameraAuthorized():Boolean {
return permissionGiven; return !(camera.muted);
} }
public function hasCamera():Boolean { public function hasCamera():Boolean {
return (Camera.names.length != 0); return (Camera.names.length != 0);
} }
public function statusHandler(event:StatusEvent):void {
switch (event.code)
{
case "Camera.Muted":
// User clicked Deny.
permissionGiven = false;
break;
case "Camera.Unmuted":
// "User clicked Accept.
permissionGiven = true;
break;
}
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment