User interface good, sound recording not working.
This commit is contained in:
parent
1687242ba4
commit
3fc615b182
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){
|
||||
|
|
|
@ -87,17 +87,13 @@
|
|||
c ((columns col) (if long? :upper-latin :lower-latin))
|
||||
audio (format "audio/%02d%s.mp3" r c)
|
||||
char ((entries row) col)]
|
||||
(vector :td {:class "entry"
|
||||
:id (format "%s%02d%s" (if long? "l" "s") r c)
|
||||
;; :onclick (format
|
||||
;; "showPopup( '%s', '%s', '%s', '%s')"
|
||||
;; (if long? row (+ row 40))
|
||||
;; col
|
||||
;; char
|
||||
;; audio)
|
||||
}
|
||||
;; (audio row col long?)
|
||||
char)))
|
||||
(vector :td {:class "entry"}
|
||||
[:span {:class "entry-text"
|
||||
:id (format "%s%02d%s" (if long? "l" "s") r c)} char]
|
||||
[:br]
|
||||
[:button
|
||||
{:onclick (str "new Audio('" audio "').play();")}
|
||||
"►"])))
|
||||
|
||||
;; (entry-cell 3 4 true)
|
||||
|
||||
|
|
Loading…
Reference in a new issue