Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
25874c29
Commit
25874c29
authored
11 years ago
by
David Ormsbee
Browse files
Options
Downloads
Patches
Plain Diff
add face capture button
parent
9b438713
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/verify_student/views.py
+0
-3
0 additions, 3 deletions
lms/djangoapps/verify_student/views.py
lms/templates/verify_student/photo_verification.html
+62
-54
62 additions, 54 deletions
lms/templates/verify_student/photo_verification.html
with
62 additions
and
57 deletions
lms/djangoapps/verify_student/views.py
+
0
−
3
View file @
25874c29
...
...
@@ -87,13 +87,10 @@ def final_verification(request):
context
=
{
"
course_id
"
:
"
edX/Certs101/2013_Test
"
}
return
render_to_response
(
"
verify_student/final_verification.html
"
,
context
)
#
def
show_verification_page
(
request
):
pass
def
enroll
(
user
,
course_id
,
mode_slug
):
"""
Enroll the user in a course for a certain mode.
...
...
This diff is collapsed.
Click to expand it.
lms/templates/verify_student/photo_verification.html
+
62
−
54
View file @
25874c29
...
...
@@ -8,74 +8,79 @@
<!-- please move link to js/vendor/responsive-carousel/responsive-carousel.js from main.html to here -->
<script
type=
"text/javascript"
>
function
hasGetUserMedia
()
{
// Note: Opera is unprefixed.
return
!!
(
navigator
.
getUserMedia
||
navigator
.
webkitGetUserMedia
||
navigator
.
mozGetUserMedia
||
navigator
.
msGetUserMedia
);
}
var
onFailSoHard
=
function
(
e
)
{
var
onVideoFail
=
function
(
e
)
{
console
.
log
(
'
Failed to get camera access!
'
,
e
);
};
/*
// Not showing vendor prefixes.
navigator.getUserMedia({video: true }, function(localMediaStream) {
var video = document.querySelector('video');
video.src = window.URL.createObjectURL(localMediaStream);
// Note: onloadedmetadata doesn't fire in Chrome when using it with getUserMedia.
// See crbug.com/110938.
video.onloadedmetadata = function(e) {
// Ready to go. Do some stuff.
};
}, onFailSoHard);
*/
function
initVideoCapture
()
{
window
.
URL
=
window
.
URL
||
window
.
webkitURL
;
navigator
.
getUserMedia
=
navigator
.
getUserMedia
||
navigator
.
webkitGetUserMedia
||
navigator
.
mozGetUserMedia
||
navigator
.
msGetUserMedia
;
$
(
'
video
'
).
each
(
function
(
i
,
video
)
{
if
(
navigator
.
getUserMedia
)
{
navigator
.
getUserMedia
({
video
:
true
},
function
(
stream
)
{
video
.
src
=
window
.
URL
.
createObjectURL
(
stream
);
},
onFailSoHard
);
}
else
{
video
.
src
=
'
somevideo.webm
'
;
// fallback.
// // Make all the video pieces active
// $('video').each(function(i, video) {
// if (navigator.getUserMedia) {
// navigator.getUserMedia({video: true}, function(stream) {
// video.src = window.URL.createObjectURL(stream);
// }, onVideoFail);
// } else {
// video.src = 'somevideo.webm'; // fallback.
// }
// });
}
var
submitToPaymentProcessing
=
function
()
{
// $("#pay_form")
var
xhr
=
$
.
post
(
"
create_order
"
,
{
"
course_id
"
:
"
${course_id|u}
"
},
function
(
data
)
{
for
(
prop
in
data
)
{
$
(
'
<input>
'
).
attr
({
type
:
'
hidden
'
,
name
:
prop
,
value
:
data
[
prop
]
}).
appendTo
(
'
#pay_form
'
);
}
}
});
)
.
done
(
function
(
data
)
{
$
(
"
#pay_form
"
).
submit
();
})
.
fail
(
function
()
{
alert
(
"
error
"
);
});
}
function
initFaceSnapshotHandler
()
{
var
video
=
$
(
'
#face_video
'
);
var
canvas
=
$
(
'
#face_canvas
'
);
var
ctx
=
canvas
[
0
].
getContext
(
'
2d
'
);
var
localMediaStream
=
null
;
function
snapshot
()
{
if
(
localMediaStream
)
{
ctx
.
drawImage
(
video
[
0
],
0
,
0
);
$
(
'
#face_image
'
).
src
=
canvas
[
0
].
toDataURL
(
'
image/webp
'
);
}
}
video
.
click
(
snapshot
);
$
(
"
#face_capture_button
"
).
click
(
snapshot
);
navigator
.
getUserMedia
({
video
:
true
},
function
(
stream
)
{
video
.
src
=
window
.
URL
.
createObjectURL
(
stream
);
localMediaStream
=
stream
;
},
onVideoFail
);
}
$
(
document
).
ready
(
function
()
{
$
(
"
.carousel-nav
"
).
addClass
(
'
sr
'
);
$
(
"
#pay_button
"
).
click
(
submitToPaymentProcessing
);
initVideoCapture
();
$
(
"
#pay_button
"
).
click
(
function
(){
// $("#pay_form")
var
xhr
=
$
.
post
(
"
create_order
"
,
{
"
course_id
"
:
"
${course_id|u}
"
},
function
(
data
)
{
for
(
prop
in
data
)
{
$
(
'
<input>
'
).
attr
({
type
:
'
hidden
'
,
name
:
prop
,
value
:
data
[
prop
]
}).
appendTo
(
'
#pay_form
'
);
}
$
(
"
#pay_form
"
).
submit
()
}
)
.
done
(
function
(
data
)
{
alert
(
data
);
})
.
fail
(
function
()
{
alert
(
"
error
"
);
});
});
initFaceSnapshotHandler
();
});
...
...
@@ -112,7 +117,10 @@
<div
id=
"facecam"
class=
"cam"
>
<div
class=
"placeholder-cam"
>
<video
autoplay
></video>
<video
id=
"face_video"
autoplay
></video><br/>
<img
id=
"face_image"
src=
""
/><br/>
<canvas
id=
"face_canvas"
style=
"display:none;"
></canvas>
<button
id=
"face_capture_button"
type=
"button"
>
Take Picture
</button>
</div>
<div
class=
"controls photo-controls"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment