Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
dea1878e
Commit
dea1878e
authored
Sep 10, 2013
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Require that permission be given for Flash camera before we process snapshots.
parent
37ad3662
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
3 deletions
+31
-3
lms/static/js/verify_student/CameraCapture.as
+24
-1
lms/static/js/verify_student/CameraCapture.swf
+0
-0
lms/static/js/verify_student/photocapture.js
+7
-2
No files found.
lms/static/js/verify_student/CameraCapture.as
View file @
dea1878e
...
...
@@ -18,11 +18,13 @@ 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
;
import
flash
.
media
.
Video
;
import
flash
.
utils
.
ByteArray
;
import
mx
.
utils
.
Base64Encoder
;
[
SWF
(
width
=
"640"
,
height
=
"480"
)]
...
...
@@ -35,15 +37,17 @@ package
private
var
camera
:
Camera
;
private
var
video
:
Video
;
private
var
b64EncodedImage
:
String
=
null
;
private
var
permissionGiven
:
Boolean
=
false
;
public
function
CameraCapture
()
{
addEventListener
(
Event
.
ADDED_TO_STAGE
,
init
)
;
addEventListener
(
Event
.
ADDED_TO_STAGE
,
init
)
;
}
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
)
;
...
...
@@ -53,6 +57,7 @@ package
ExternalInterface
.
addCallback
(
"snap"
,
snap
)
;
ExternalInterface
.
addCallback
(
"reset"
,
reset
)
;
ExternalInterface
.
addCallback
(
"imageDataUrl"
,
imageDataUrl
)
;
ExternalInterface
.
addCallback
(
"cameraAuthorized"
,
cameraAuthorized
)
;
// Notify the container that the SWF is ready to be called.
ExternalInterface
.
call
(
"setSWFIsReady"
)
;
...
...
@@ -98,6 +103,24 @@ package
}
return
""
;
}
public
function
cameraAuthorized
()
:
Boolean
{
return
permissionGiven
;
}
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
;
}
}
}
}
lms/static/js/verify_student/CameraCapture.swf
View file @
dea1878e
No preview for this file type
lms/static/js/verify_student/photocapture.js
View file @
dea1878e
...
...
@@ -124,7 +124,12 @@ function initSnapshotHandler(names, hasHtml5CameraSupport) {
video
[
0
].
pause
();
}
else
{
image
[
0
].
src
=
flashCapture
[
0
].
snap
();
if
(
flashCapture
[
0
].
cameraAuthorized
())
{
image
[
0
].
src
=
flashCapture
[
0
].
snap
();
}
else
{
return
false
;
}
}
doSnapshotButton
(
captureButton
,
resetButton
,
approveButton
);
...
...
@@ -186,7 +191,7 @@ function initSnapshotHandler(names, hasHtml5CameraSupport) {
function
objectTagForFlashCamera
(
name
)
{
return
'<object type="application/x-shockwave-flash" id="'
+
name
+
'" name="'
+
name
+
'" data='
+
'"/static/js/verify_student/CameraCapture.swf"'
+
'"/static/js/verify_student/CameraCapture.swf
?v=2
"'
+
'width="500" height="375"><param name="quality" '
+
'value="high"><param name="allowscriptaccess" '
+
'value="sameDomain"></object>'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment