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 @@
* assign this return value to an img's src attribute.
* reset() restarts the the video.
* 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
......@@ -18,7 +22,6 @@ package
import flash.display.PNGEncoderOptions;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.StatusEvent;
import flash.external.ExternalInterface;
import flash.geom.Rectangle;
import flash.media.Camera;
......@@ -37,7 +40,6 @@ package
private var camera:Camera;
private var video:Video;
private var b64EncodedImage:String = null;
private var permissionGiven:Boolean = false;
public function CameraCapture()
{
......@@ -47,7 +49,6 @@ package
protected function init(e:Event):void {
camera = Camera.getCamera();
camera.setMode(VIDEO_WIDTH, VIDEO_HEIGHT, 30);
camera.addEventListener(StatusEvent.STATUS, statusHandler);
video = new Video(VIDEO_WIDTH, VIDEO_HEIGHT);
video.attachCamera(camera);
......@@ -106,26 +107,12 @@ package
}
public function cameraAuthorized():Boolean {
return permissionGiven;
return !(camera.muted);
}
public function hasCamera():Boolean {
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