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
25874c29
Commit
25874c29
authored
Aug 22, 2013
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add face capture button
parent
9b438713
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
57 deletions
+62
-57
lms/djangoapps/verify_student/views.py
+0
-3
lms/templates/verify_student/photo_verification.html
+62
-54
No files found.
lms/djangoapps/verify_student/views.py
View file @
25874c29
...
@@ -87,13 +87,10 @@ def final_verification(request):
...
@@ -87,13 +87,10 @@ def final_verification(request):
context
=
{
"course_id"
:
"edX/Certs101/2013_Test"
}
context
=
{
"course_id"
:
"edX/Certs101/2013_Test"
}
return
render_to_response
(
"verify_student/final_verification.html"
,
context
)
return
render_to_response
(
"verify_student/final_verification.html"
,
context
)
#
def
show_verification_page
(
request
):
def
show_verification_page
(
request
):
pass
pass
def
enroll
(
user
,
course_id
,
mode_slug
):
def
enroll
(
user
,
course_id
,
mode_slug
):
"""
"""
Enroll the user in a course for a certain mode.
Enroll the user in a course for a certain mode.
...
...
lms/templates/verify_student/photo_verification.html
View file @
25874c29
...
@@ -8,74 +8,79 @@
...
@@ -8,74 +8,79 @@
<!-- please move link to js/vendor/responsive-carousel/responsive-carousel.js from main.html to here -->
<!-- please move link to js/vendor/responsive-carousel/responsive-carousel.js from main.html to here -->
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
function
hasGetUserMedia
()
{
var
onVideoFail
=
function
(
e
)
{
// Note: Opera is unprefixed.
return
!!
(
navigator
.
getUserMedia
||
navigator
.
webkitGetUserMedia
||
navigator
.
mozGetUserMedia
||
navigator
.
msGetUserMedia
);
}
var
onFailSoHard
=
function
(
e
)
{
console
.
log
(
'Failed to get camera access!'
,
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
()
{
function
initVideoCapture
()
{
window
.
URL
=
window
.
URL
||
window
.
webkitURL
;
window
.
URL
=
window
.
URL
||
window
.
webkitURL
;
navigator
.
getUserMedia
=
navigator
.
getUserMedia
||
navigator
.
webkitGetUserMedia
||
navigator
.
getUserMedia
=
navigator
.
getUserMedia
||
navigator
.
webkitGetUserMedia
||
navigator
.
mozGetUserMedia
||
navigator
.
msGetUserMedia
;
navigator
.
mozGetUserMedia
||
navigator
.
msGetUserMedia
;
$
(
'video'
).
each
(
function
(
i
,
video
)
{
// // Make all the video pieces active
if
(
navigator
.
getUserMedia
)
{
// $('video').each(function(i, video) {
navigator
.
getUserMedia
({
video
:
true
},
function
(
stream
)
{
// if (navigator.getUserMedia) {
video
.
src
=
window
.
URL
.
createObjectURL
(
stream
);
// navigator.getUserMedia({video: true}, function(stream) {
},
onFailSoHard
);
// video.src = window.URL.createObjectURL(stream);
}
else
{
// }, onVideoFail);
video
.
src
=
'somevideo.webm'
;
// fallback.
// } 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
()
{
$
(
document
).
ready
(
function
()
{
$
(
".carousel-nav"
).
addClass
(
'sr'
);
$
(
".carousel-nav"
).
addClass
(
'sr'
);
$
(
"#pay_button"
).
click
(
submitToPaymentProcessing
);
initVideoCapture
();
initVideoCapture
();
initFaceSnapshotHandler
();
$
(
"#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"
);
});
});
});
});
...
@@ -112,7 +117,10 @@
...
@@ -112,7 +117,10 @@
<div
id=
"facecam"
class=
"cam"
>
<div
id=
"facecam"
class=
"cam"
>
<div
class=
"placeholder-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>
<div
class=
"controls photo-controls"
>
<div
class=
"controls photo-controls"
>
...
...
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