Commit e498ad52 by David Ormsbee Committed by Diana Huang

Add hasCamera() method to flash camera detection

parent 53d376b6
...@@ -58,6 +58,7 @@ package ...@@ -58,6 +58,7 @@ package
ExternalInterface.addCallback("reset", reset); ExternalInterface.addCallback("reset", reset);
ExternalInterface.addCallback("imageDataUrl", imageDataUrl); ExternalInterface.addCallback("imageDataUrl", imageDataUrl);
ExternalInterface.addCallback("cameraAuthorized", cameraAuthorized); ExternalInterface.addCallback("cameraAuthorized", cameraAuthorized);
ExternalInterface.addCallback("hasCamera", hasCamera);
// Notify the container that the SWF is ready to be called. // Notify the container that the SWF is ready to be called.
ExternalInterface.call("setSWFIsReady"); ExternalInterface.call("setSWFIsReady");
...@@ -108,6 +109,10 @@ package ...@@ -108,6 +109,10 @@ package
return permissionGiven; return permissionGiven;
} }
public function hasCamera():Boolean {
return (Camera.names.length != 0);
}
public function statusHandler(event:StatusEvent):void { public function statusHandler(event:StatusEvent):void {
switch (event.code) switch (event.code)
{ {
......
...@@ -189,9 +189,11 @@ function initSnapshotHandler(names, hasHtml5CameraSupport) { ...@@ -189,9 +189,11 @@ function initSnapshotHandler(names, hasHtml5CameraSupport) {
} }
function objectTagForFlashCamera(name) { function objectTagForFlashCamera(name) {
// I manually update this to have ?v={2,3,4, etc} to avoid caching of flash
// objects on local dev.
return '<object type="application/x-shockwave-flash" id="' + return '<object type="application/x-shockwave-flash" id="' +
name + '" name="' + name + '" data=' + name + '" name="' + name + '" data=' +
'"/static/js/verify_student/CameraCapture.swf?v=2"' + '"/static/js/verify_student/CameraCapture.swf?v=3"' +
'width="500" height="375"><param name="quality" ' + 'width="500" height="375"><param name="quality" ' +
'value="high"><param name="allowscriptaccess" ' + 'value="high"><param name="allowscriptaccess" ' +
'value="sameDomain"></object>'; 'value="sameDomain"></object>';
......
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