User interface good, sound recording not working.
This commit is contained in:
parent
1687242ba4
commit
3fc615b182
3 changed files with 5634 additions and 950 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -19,8 +19,11 @@ const studentSounds = Array(80).fill(0).map(x => Array(13).fill(null));
|
|||
|
||||
|
||||
function recordStudentSound(r, c) {
|
||||
console.info("Entered recordStudentSound for row " + r + ", column " + c);
|
||||
|
||||
if (Number.isInteger(r) && Number.isInteger(c)) {
|
||||
$('#record-student').css('color', 'green');
|
||||
try {
|
||||
navigator.mediaDevices.getUserMedia({ audio: true })
|
||||
.then(stream => {
|
||||
const mediaRecorder = new MediaRecorder(stream);
|
||||
|
|
@ -40,16 +43,21 @@ function recordStudentSound(r, c) {
|
|||
console.log("Successfully recorded student sound for row " + r + ", column " + c);
|
||||
} else {
|
||||
console.warn("Failed to record student sound for row " + r + ", column " + c);
|
||||
window.alert("No sound detected. Check your microphone?");
|
||||
}
|
||||
$('#record-student').css('color', 'red');
|
||||
|
||||
}, 3000);
|
||||
});
|
||||
} catch (error) {
|
||||
console.error( error);
|
||||
window.alert("Sound recording is only possible on secure connections.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$(".entry").on("click", function(e) {
|
||||
$(".entry-text").on("click", function(e) {
|
||||
let cellId = e.currentTarget ? e.currentTarget.id : null;
|
||||
|
||||
if (cellId)
|
||||
|
|
@ -73,7 +81,7 @@ $(document).ready(function() {
|
|||
'top': e.pageY
|
||||
});
|
||||
|
||||
$("#character").text(e.currentTarget.innerText +": " + row +"," + col + ".");
|
||||
$("#character").text(e.currentTarget.innerText.substring(0, 1));
|
||||
|
||||
$("#play-tutor").off("click"); /* trying to remove any previous click handler */
|
||||
$("#play-tutor").on("click", function(e){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue