classroom/public/lessons/js/lessonV4.9.js
// This functions is called from everywhere ,to play TTS  

This functions is called from everywhere ,to play TTS
This functions is called from everywhere to play TTS
function playAudio(text, language) {
	console.log("play at start : "+text);
}
function playAudio ( text , language ) { console . log ( "play at start : " + text ) ; }
This functions is called from everywhere ,to play TTS
This functions is called from everywhere to play TTS
/*
	text = text.trim();
	temx = removeSpecialCharacter(text);
	text = text.replace("%","percent1");
	var processedText = decodeURI(text);
	processedText = processedText.replace("percent1","%");
	if(processedText in soundWords){
		processedText = soundWords[processedText];
	}
//	stopAllAudio();
	var found = false;
	$(".audio").each(function(){
		if( removeSpecialCharacter($(this).attr("text").replace(/\s+/g, '')) == processedText.trim().replace(/\s+/g, '')){
			if($(this)[0].duration > 0){
				$(this)[0].play();
			}else{
				$(this)[0].load();
				$(this)[0].play();
			}
			found = true;
			return false;
		}
	});
	if(!found){
		text=text.trim();
		text=text.replace("%","percent1");
		var processedText = decodeURI(text);
		processedText = processedText.replace("percent1","%");
		var number = $('.audioDiv').children().size();
		$(".audioDiv").append('<audio class="audio audio'+number+'" text="'+processedText.trim()+'" style="display:none;"><source class="source source'+number+'" src="" type="audio/mp3"></source></audio>');
		
		var x = $('.audio'+number)[0];
		var source = $('.source'+number);
		console.log("play :",processedText);
//		source.attr("src",'https://voice.helloenglish.com/file/'+window.parent.defaultLocale+'/'+processedText);
		source.attr("src",'https://mail.culturealley.com/english-app/utility/getTTSSoundFile.php?text='+processedText+'&locale='+window.parent.defaultLocale);
		x.load();
		x.play();
	}
	*/ //	var x = document.getElementById("audio"); 
 //	var source = document.getElementById("mp3_src");
 //    source.src='https://voice.helloenglish.com/file/'+processedText;
 //    x.load();
 //	x.play();
 //	var translatedWordlanguage = bcp47CodeForLanguage(language);
 //	var mySoundObject = soundManager.createSound({
 ////		url: "//mail.culturealley.com/ttsCultureAlley.php?tl="+translatedWordlanguage+"&q="+encodeURIComponent(processedText);
 //		url: "https://192.168.1.4:3000/file/"+encodeURIComponent(processedText),
 //		autoLoad: true,
 //		autoPlay: true,
 //		onload: function() {
 //			alert('The sound '+this.id+' loaded!');
 //		}
 //	});
