Commit a137a990 authored by Sylvain Coulange's avatar Sylvain Coulange
Browse files

debug player cptItems, volume audio, premier item ajouté

parent 2b060fe9
Credits
Phonetic colours:
© Kinephones (https://kinephones.hypotheses.org/)
Phonetic charts:
© Alexandre Do (do.alexandre38@gmail.com)
Fidels (spelling charts):
© Alexandre Do (do.alexandre38@gmail.com)
© Pronunciation Science (https://www.pronunciationscience.com/)
Audio:
- select sound © Ryusa https://freesound.org/s/467554/
- correct answer © FunWithSound https://freesound.org/s/456965/
- wrong answer © Raclure https://freesound.org/s/483598/
- success melody © FunWithSound https://freesound.org/s/456966/
-
......@@ -95,9 +95,11 @@ function recupPhon(identifiant) {
newCarte.style.backgroundImage = "url('/static/bouches/"+ boucheId + ".jpg')";
newCarte.addEventListener("click", function(e) {
var tgt = e.target;
playEffect("delete");
tgt.remove();
});
repDiv.appendChild(newCarte);
playEffect("select");
}
......@@ -152,26 +154,22 @@ function demarrer() {
// charge le mot suivant
function loadNext() {
document.getElementById("bravo").style.display = "none";
if (cptitem < nbmots-1) {
cptitem = cptitem+1;
document.getElementById('cptitem').innerHTML = cptitem;
if (cptitem < nbmots) {
rep.innerHTML = "";
currentAudio = '/static/audio/s0/'+mots[cptitem]["audio"];
playAudio();
cptitem = cptitem+1;
document.getElementById('cptitem').innerHTML = cptitem;
} else {
rep.innerHTML = "<h1>Félicitations !</h1>";
playEffect("success");
}
}
function playAudio() {
var audio = new Audio(currentAudio);
audio.play();
}
// vérifie la réponse
function checkAnswer() {
var phono = mots[cptitem]["phono"];
var phono = mots[cptitem-1]["phono"]; // cptitem-1 parce qu'on a déjà incrémenté cptitem lors de loadNext()
var erreur = false;
if (rep.children.length == phono.length) {
......@@ -192,9 +190,18 @@ function checkAnswer() {
}
}
// SOUNDS
function playAudio() {
var audio = new Audio(currentAudio);
audio.play();
}
function playEffect(effect) {
var audio;
if (effect == "success") audio = new Audio("/static/audio/effets/success.mp3");
if (effect == "select") audio = new Audio("/static/audio/effets/select.mp3");
else if (effect == "delete") audio = new Audio("/static/audio/effets/del.mp3");
else if (effect == "success") audio = new Audio("/static/audio/effets/success.mp3");
else if (effect == "correct") audio = new Audio("/static/audio/effets/correctAnswer.mp3");
else if (effect == "wrong") audio = new Audio("/static/audio/effets/wrongAnswer.mp3");
audio.play();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment