Commit 4d126dcb authored by Sylvain Coulange's avatar Sylvain Coulange
Browse files

finalisation nouveau player première version

parent f17f1ea9
......@@ -107,7 +107,7 @@ function toList(s) {
function addMot(mot,trans=[],i) {
console.log(mot, trans, i)
i = Math.floor(Math.random() * 1000);
i = Math.floor(Math.random() * 10000);
var divMot = document.createElement('div');
divMot.id = 'divMot-' + i;
divMot.classList = 'ui-state-default d-flex flex-row align-items-center divMot';
......
const thisAppli = "phonoplayer";
// PARAMÉTRAGE SÉRIE
var serieId = sc.id;
var serieName = sc.nom;
var audioDeb = "audioDeb" in sc ? sc.audioDeb : 0;
var imageDeb = "imageDeb" in sc ? sc.imageDeb : 0;
var videoDeb = "videoDeb" in sc ? sc.videoDeb : 0;
var graphieDeb = "graphieDeb" in sc ? sc.graphieDeb : 0;
var audioFin = "audioFin" in sc ? sc.audioFin : 0;
var imageFin = "imageFin" in sc ? sc.imageFin : 0;
var videoFin = "videoFin" in sc ? sc.videoFin : 0;
var graphieFin = "graphieFin" in sc ? sc.graphieFin : 0;
var phonoFin = "phonoFin" in sc ? sc.phonoFin : 0;
audioFin = 0;
var syntheseVocale = sc.syntheseVocale;
var panneauPartiel = sc.panneauPartiel;
var phonActifs = JSON.parse(sc.phonVisibles);
panneauPartiel = (panneauPartiel==1) ? true : false
syntheseVocale = (syntheseVocale==1) ? true : false
let videoMode = false
let audioMode = false
if (videoDeb==1) {
videoMode = true
} else {
audioMode = true
}
selectLang("fr");
function selectLang(lang, p="default", f="default"){
console.log('SelectLang()',lang)
......@@ -154,7 +186,7 @@ var btnValider = document.getElementById("btnValider")
if (videoMode) document.getElementById('btnVideo').style.display = 'block'
if (audioMode) document.getElementById('btnAudio').style.display = 'block'
if (synthvoc) document.getElementById('divSynthVoc').style.display = 'block'
if (syntheseVocale) document.getElementById('divSynthVoc').style.display = 'block'
// LANCEMENT DE L'ACTIVITÉ PAR DEFAUT (TRANSMISE AVEC LE TEMPLATE cf. views.py)
nbmots = mots.length
......@@ -169,7 +201,7 @@ function demarrer() {
document.getElementById('divConsigne').style.display = "block"
document.getElementById('divReponse').style.display = ""
cptitem = 0
if (audio_R == 1) {
if (audioFin == 1) {
document.getElementById('bravo_audio').style.display = "block"
}
saveTrace(`start serie ${serieName}`)
......@@ -192,7 +224,7 @@ function loadNext() {
document.getElementById('video').load()
playVideo()
}
if (audio_R == 1) {
if (audioFin == 1) {
// Si lecture audio à la fin, quand réponse correcte
currentAudio_R = mots[cptitem]["audio_R"]
}
......@@ -282,34 +314,6 @@ function checkAnswer() {
} else {
playEffect('wrong')
}
// for (i=0; i<rep.children.length; i++) {
// var repphon = rep.children[i].classList[1].replace("rect","phon")
// if (repphon != phono[i]) {
// erreur = true
// // console.log(`ERREUR ${repphon} attendu: ${phono[i]}`)
// playEffect('wrong')
// rep.children[i].classList.add("wrongPhon")
// saveTrace(`erreur ${repphon} attendu: ${phono[i]}`)
// }
// }
// if (rep.children.length != phono.length) {
// erreur = true
// // console.log("ERREUR nb phonèmes")
// playEffect('wrong')
// saveTrace(`erreur nb phon ${rep.children.length} attendu:${phono.length}`)
// }
// if (!erreur) {
// playEffect("correct")
// setTimeout(playAudio_R(), 2000)
// getBravo(mot)
// saveTrace('correct')
// }
}
function compareRepRef(myrep, ref) {
......@@ -402,14 +406,15 @@ function compareRepRef(myrep, ref) {
function getBravo(mot) {
var bravoDiv = document.getElementById("bravo")
document.getElementById("bravo_text").innerHTML = ""
if (images=='1' && mot["imageFin"].length>0){
if (imageFin=='1' && mot["imageFin"].length>0){
// document.getElementById("bravo_img").src = "/static/im/series/" + mot["image"]["src"]
document.getElementById("bravo_img").src = "../../media/image-uploads/" + mot["imageFin"]
} else {
document.getElementById("bravo_img").src = "/static/im/series/bravo.png"
}
if (phono=='1'){
if (phonoFin=='1'){
var phonographie = mot["phonographies"][0]
for (i=0; i<phonographie.length; i++){
document.getElementById("bravo_text").innerHTML += "<span class='graphContours "+ phonographie[i][0] +"'>"+ phonographie[i][1] +"</span>"
......@@ -448,7 +453,7 @@ function playAudio() {
}
function playAudio_R() {
if( audio_R == 1) {
if( audioFin == 1) {
var audio = new Audio("../../media/audio-uploads/"+currentAudio_R)
audio.play()
saveTrace("playAudio_R")
......
......@@ -14,35 +14,35 @@
var sc = JSON.parse("{{ serieJson|escapejs }}");
var mots = JSON.parse("{{ serie.mots|escapejs }}");
var serieId = sc.id;
var serieName = sc.nom;
// var serieId = sc.id;
// var serieName = sc.nom;
var images = sc.imageFin;
var phono = sc.phonoFin;
var audio_R = sc.audioFin;
audio_R = 0;
var video = sc.videoDeb;
var synthvoc = sc.syntheseVocale;
var panneauPartiel = sc.panneauPartiel;
var phonActifs = JSON.parse(sc.phonVisibles);
panneauPartiel = (panneauPartiel==1) ? true : false
synthvoc = (synthvoc==1) ? true : false
let videoMode = false
let audioMode = false
if (video==1) {
videoMode = true
} else {
audioMode = true
}
console.log("Mots:",mots);
console.log("ImageFin:",images);
console.log("PhonoFin:",phono);
console.log("AudioFin:(blocked)",audio_R);
console.log("AudioDeb:",audioMode);
console.log("VideoDeb:",videoMode);
console.log("PanneauPartiel:",panneauPartiel);
console.log("Phonèmes actifs:", phonActifs)
console.log("Synthèse vocale:", synthvoc)
// var images = sc.imageFin;
// var phono = sc.phonoFin;
// var audio_R = sc.audioFin;
// audio_R = 0;
// var video = sc.videoDeb;
// var synthvoc = sc.syntheseVocale;
// var panneauPartiel = sc.panneauPartiel;
// var phonActifs = JSON.parse(sc.phonVisibles);
// panneauPartiel = (panneauPartiel==1) ? true : false
// synthvoc = (synthvoc==1) ? true : false
// let videoMode = false
// let audioMode = false
// if (video==1) {
// videoMode = true
// } else {
// audioMode = true
// }
// console.log("Mots:",mots);
// console.log("ImageFin:",images);
// console.log("PhonoFin:",phono);
// console.log("AudioFin:(blocked)",audio_R);
// console.log("AudioDeb:",audioMode);
// console.log("VideoDeb:",videoMode);
// console.log("PanneauPartiel:",panneauPartiel);
// console.log("Phonèmes actifs:", phonActifs)
// console.log("Synthèse vocale:", synthvoc)
var userName = "{{ user.username }}";
if (userName) {
......
......@@ -205,7 +205,7 @@
</fieldset>
</form>
<div>
<center><button class="btn btn-outline-info" onclick="makeSerieMots()">ValiderTest</button></center>
<center><button class="btn btn-outline-info" title="Enregistrer la série" onclick="makeSerieMots()">Enregistrer</button></center>
</div>
......@@ -273,7 +273,7 @@ phon_d, phon_r_maj, phon_o_maj, phon_m"></textarea>
<div class="modal-dialog modal-dialog-scrollable modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Choisir un fichier <span id="modalTypMedia"></span><span id="modalTargetDir"></span> (i=<span id="modalI"></span>)</h5>
<h5 class="modal-title" id="exampleModalLabel">Choisir un fichier <span id="modalTypMedia" style="display:none"></span><span id="modalTargetDir"></span> <span style="display: none;" id="modalI"></span></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
......
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