-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated text to cloud audio lang selectors
- Loading branch information
1 parent
8dbef5d
commit 70ebb1b
Showing
1 changed file
with
1 addition
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"name":"Text to Audio (Cloud)","key":"tta","version":"1.0.8","instructions":"Enter the text to be read between the 'tta' tags after they are inserted on the page. (Uses Cloud Poodll) ","showatto":"1","showplayers":"0","requirecss":"","requirejs":"","shim":"","defaults":"format=\"text|ssml\",language=\"English(US)|English(GB)|English(AU)|English(In)|English(Welsh)|Arabic|Danish|Dutch|Dutch(BE)|Farsi|French(FR)|French(CA)|German|Hebrew|Icelandic|Italian|Japanese|Korean|Norwegian|Polish|Portugese(BR)|Portugese(PT)|Romanian|Russian|Spanish(ES)|Spanish(US)|Swedish|Turkish|Welsh\",\nspeaker=\"Male|Female\"","amd":"1","body":"<audio id=\"@@AUTOID@@_audioplayer\" class=\"nomediaplugin\" controls/>\n<!-- @@CLOUDPOODLLTOKEN@@ -->\n<div id=\"@@AUTOID@@\" class='hide nolink'>","bodyend":"</div>","script":"//FUNCTION fetch polly url\n var fetch_polly_url = function(speaktext, voice, format, callback) {\n\n //The REST API we are calling\n var functionname = 'local_cpapi_fetch_polly_url';\n\n //fetch the Posturl. We need this.\n //set up our ajax request\n var xhr = new XMLHttpRequest();\n var that = this;\n\n //set up our handler for the response\n xhr.onreadystatechange = function (e) {\n if (this.readyState === 4) {\n if (xhr.status == 200) {\n\n //get a yes or forgetit or tryagain\n var payload = xhr.responseText;\n var payloadobject = JSON.parse(payload);\n if (payloadobject) {\n //returnCode > 0 indicates an error\n if (payloadobject.returnCode > 0) {\n console.log(payloadobject.returnMessage);\n return false;\n //if all good, then lets do the embed\n } else if (payloadobject.returnCode === 0){\n var pollyurl = payloadobject.returnMessage;\n callback(pollyurl);\n } else {\n console.log('Polly Signed URL Request failed:');\n console.log(payloadobject);\n }\n } else {\n console.log('Polly Signed URL Request something bad happened');\n }\n } else {\n console.log('Polly Signed URL Request Not 200 response:' + xhr.status);\n }\n }\n };\n\n //make our request\n var xhrparams = \"wstoken=\" + @@CLOUDPOODLLTOKEN@@\n + \"&wsfunction=\" + functionname\n + \"&moodlewsrestformat=\" + 'json'\n + \"&text=\" + encodeURIComponent(speaktext)\n + '&texttype=' + format\n + '&voice=' + voice\n + '&appid=' + 'filter_poodll'\n + '&owner=poodll'\n + '®ion=useast1';\n\n var serverurl = 'https://cloud.poodll.com' + \"/webservice/rest/server.php\";\n xhr.open(\"POST\", serverurl, true);\n xhr.setRequestHeader(\"Cache-Control\", \"no-cache\");\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n xhr.send(xhrparams);\n };\n\n\nvar usetext = $('#' + @@AUTOID@@).text();\nvar theplayer = $('#' + @@AUTOID@@ + '_audioplayer');\nvar mf=@@speaker@@\n\nswitch(@@language@@){\n case \"English(US)\": this.voice = mf=='Male'?'Joey':'Kendra';break;\n case \"English(GB)\": this.voice = mf=='Male'?'Brian':'Amy';break;\n case \"English(AU)\": this.voice = mf=='Male'?'Russell':'Nicole';break;\n case \"English(IN)\": this.voice = mf=='Male'?'Aditi':'Raveena';break;\n case \"English(WELSH)\": this.voice = mf=='Male'? 'Geraint':'Geraint';break;\n case \"Arabic\": this.voice = mf=='Male'?'ar-XA-Wavenet-B':'Zeina';break;\n case \"Bulgarian\": this.voice = mf=='Male'? 'bg-BG-Standard-A':'bg-BG-Standard-A';break;\n case \"Czech\": this.voice = mf=='Male'? 'cs-CZ-Standard-A':'cs-CZ-Wavenet-A';break;\n case \"Danish\": this.voice = mf=='Male'?'Mads':'Naja';break;\n case \"Dutch\": this.voice = mf=='Male'?'Ruben':'Lotte';break;\n case \"Dutch(BE)\": this.voice = mf=='Male'?'nl-BE-Wavenet-B':'nl-BE-Wavenet-A';break;\n case \"French(FR)\": this.voice = mf=='Male'?'Mathieu':'Celine';break;\n case \"French(CA)\": this.voice = mf=='Male'?'Chantal':'Chantal';break;\n case \"German\": this.voice = mf=='Male'?'Hans':'Marlene';break;\n case \"Greek\": this.voice = mf=='Male'? 'el-GR-Wavenet-A':'el-GR-Standard-A';break;\n case \"Hebrew\": this.voice = mf=='Male'?'he-IL-Wavenet-B':'he-IL-Wavenet-A';break;\n case \"Icelandic\": this.voice = mf=='Male'?'Karl':'Dora';break;\n case \"Italian\": this.voice = mf=='Male'?'Carla':'Giorgio';break;\n case \"Japanese\": this.voice = mf=='Male'?'Takumi':'Mizuki';break;\n case \"Korean\": this.voice = mf=='Male'?'Seoyan':'Seoyan';break;\n case \"Latvian\": this.voice = mf=='Male'? 'lv-LV-Standard-A':'lv-LV-Standard-A';break;\n case \"Lithuanian\": this.voice = mf=='Male'? 'lt-LT-Standard-A':'lt-LT-Standard-A';break;\n case \"Norwegian\": this.voice = mf=='Male'?'Liv':'Liv';break;\n case \"Polish\": this.voice = mf=='Male'?'Jacek':'Ewa';break;\n case \"Portugese(BR)\": this.voice = mf=='Male'?'Ricardo':'Vitoria';break;\n case \"Portugese(PT)\": this.voice = mf=='Male'?'Cristiano':'Ines';break;\n case \"Romanian\": this.voice = mf=='Male'?'Carmen':'Carmen';break;\n case \"Russian\": this.voice = mf=='Male'?'Maxim':'Tatyana';break;\n case \"Serbian\": this.voice = mf=='Male'? 'sr-RS-Standard-A':'sr-RS-Standard-A';break;\n case \"Slovak\": this.voice = mf=='Male'? 'sk-SK-Wavenet-A':'sk-SK-Standard-A';break;\n case \"Spanish(ES)\": this.voice = mf=='Male'?'Enrique':'Conchita';break;\n case \"Spanish(US)\": this.voice = mf=='Male'?'Miguel':'Penelope';break;\n case \"Swedish\": this.voice = mf=='Male'?'Astrid':'Astrid';break;\n case \"Turkish\": this.voice = mf=='Male'?'Filiz':'Filiz';break;\n case \"Welsh\": this.voice = mf=='Male'?'Gwyneth':'Gwyneth';break;\n default: voice = mf=='Male'?'Brian':'Amy';\n}\n\n\n//we replace tags with markers to survive going into a URL and out again\n//usetext = usetext.replace(/</gi, \"PPPP\");\n//usetext = usetext.replace(/>/gi, \"dddd\");\n\nvar datastring= @@format@@ + '|' + voice + '|' + usetext;\nvar format = @@format@@;\n\nfetch_polly_url(usetext,voice,format,function(audiourl){\n theplayer.attr('src',audiourl);\n }\n);\n\n","style":"","dataset":"","datasetvars":"","alternate":"","alternateend":""} | ||
{"name":"Text to Audio (Cloud)","key":"tta","version":"1.0.8","instructions":"Enter the text to be read between the 'tta' tags after they are inserted on the page. (Uses Cloud Poodll) ","showatto":"1","showplayers":"0","requirecss":"","requirejs":"","shim":"","defaults":"format=\"text|ssml\",language=\"English(US)|English(GB)|English(AU)|English(In)|English(Welsh)|Arabic|Bulgarian|Czech|Danish|Dutch|Dutch(BE)|French(FR)|French(CA)|German|Greek|Hebrew|Icelandic|Italian|Japanese|Korean|Latvian|Lithuanian|Norwegian|Polish|Portugese(BR)|Portugese(PT)|Romanian|Russian|Serbian|Slovak|Spanish(ES)|Spanish(US)|Swedish|Turkish|Welsh\",\nspeaker=\"Male|Female\"","amd":"1","body":"<audio id=\"@@AUTOID@@_audioplayer\" class=\"nomediaplugin\" controls/>\n<!-- @@CLOUDPOODLLTOKEN@@ -->\n<div id=\"@@AUTOID@@\" class='hide nolink'>","bodyend":"</div>","script":"//FUNCTION fetch polly url\n var fetch_polly_url = function(speaktext, voice, format, callback) {\n\n //The REST API we are calling\n var functionname = 'local_cpapi_fetch_polly_url';\n\n //fetch the Posturl. We need this.\n //set up our ajax request\n var xhr = new XMLHttpRequest();\n var that = this;\n\n //set up our handler for the response\n xhr.onreadystatechange = function (e) {\n if (this.readyState === 4) {\n if (xhr.status == 200) {\n\n //get a yes or forgetit or tryagain\n var payload = xhr.responseText;\n var payloadobject = JSON.parse(payload);\n if (payloadobject) {\n //returnCode > 0 indicates an error\n if (payloadobject.returnCode > 0) {\n console.log(payloadobject.returnMessage);\n return false;\n //if all good, then lets do the embed\n } else if (payloadobject.returnCode === 0){\n var pollyurl = payloadobject.returnMessage;\n callback(pollyurl);\n } else {\n console.log('Polly Signed URL Request failed:');\n console.log(payloadobject);\n }\n } else {\n console.log('Polly Signed URL Request something bad happened');\n }\n } else {\n console.log('Polly Signed URL Request Not 200 response:' + xhr.status);\n }\n }\n };\n\n //make our request\n var xhrparams = \"wstoken=\" + @@CLOUDPOODLLTOKEN@@\n + \"&wsfunction=\" + functionname\n + \"&moodlewsrestformat=\" + 'json'\n + \"&text=\" + encodeURIComponent(speaktext)\n + '&texttype=' + format\n + '&voice=' + voice\n + '&appid=' + 'filter_poodll'\n + '&owner=poodll'\n + '®ion=useast1';\n\n var serverurl = 'https://cloud.poodll.com' + \"/webservice/rest/server.php\";\n xhr.open(\"POST\", serverurl, true);\n xhr.setRequestHeader(\"Cache-Control\", \"no-cache\");\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n xhr.send(xhrparams);\n };\n\n\nvar usetext = $('#' + @@AUTOID@@).text();\nvar theplayer = $('#' + @@AUTOID@@ + '_audioplayer');\nvar mf=@@speaker@@\n\nswitch(@@language@@){\n case \"English(US)\": this.voice = mf=='Male'?'Joey':'Kendra';break;\n case \"English(GB)\": this.voice = mf=='Male'?'Brian':'Amy';break;\n case \"English(AU)\": this.voice = mf=='Male'?'Russell':'Nicole';break;\n case \"English(IN)\": this.voice = mf=='Male'?'Aditi':'Raveena';break;\n case \"English(WELSH)\": this.voice = mf=='Male'? 'Geraint':'Geraint';break;\n case \"Arabic\": this.voice = mf=='Male'?'ar-XA-Wavenet-B':'Zeina';break;\n case \"Bulgarian\": this.voice = mf=='Male'? 'bg-BG-Standard-A':'bg-BG-Standard-A';break;\n case \"Czech\": this.voice = mf=='Male'? 'cs-CZ-Standard-A':'cs-CZ-Wavenet-A';break;\n case \"Danish\": this.voice = mf=='Male'?'Mads':'Naja';break;\n case \"Dutch\": this.voice = mf=='Male'?'Ruben':'Lotte';break;\n case \"Dutch(BE)\": this.voice = mf=='Male'?'nl-BE-Wavenet-B':'nl-BE-Wavenet-A';break;\n case \"French(FR)\": this.voice = mf=='Male'?'Mathieu':'Celine';break;\n case \"French(CA)\": this.voice = mf=='Male'?'Chantal':'Chantal';break;\n case \"German\": this.voice = mf=='Male'?'Hans':'Marlene';break;\n case \"Greek\": this.voice = mf=='Male'? 'el-GR-Wavenet-A':'el-GR-Standard-A';break;\n case \"Hebrew\": this.voice = mf=='Male'?'he-IL-Wavenet-B':'he-IL-Wavenet-A';break;\n case \"Icelandic\": this.voice = mf=='Male'?'Karl':'Dora';break;\n case \"Italian\": this.voice = mf=='Male'?'Carla':'Giorgio';break;\n case \"Japanese\": this.voice = mf=='Male'?'Takumi':'Mizuki';break;\n case \"Korean\": this.voice = mf=='Male'?'Seoyan':'Seoyan';break;\n case \"Latvian\": this.voice = mf=='Male'? 'lv-LV-Standard-A':'lv-LV-Standard-A';break;\n case \"Lithuanian\": this.voice = mf=='Male'? 'lt-LT-Standard-A':'lt-LT-Standard-A';break;\n case \"Norwegian\": this.voice = mf=='Male'?'Liv':'Liv';break;\n case \"Polish\": this.voice = mf=='Male'?'Jacek':'Ewa';break;\n case \"Portugese(BR)\": this.voice = mf=='Male'?'Ricardo':'Vitoria';break;\n case \"Portugese(PT)\": this.voice = mf=='Male'?'Cristiano':'Ines';break;\n case \"Romanian\": this.voice = mf=='Male'?'Carmen':'Carmen';break;\n case \"Russian\": this.voice = mf=='Male'?'Maxim':'Tatyana';break;\n case \"Serbian\": this.voice = mf=='Male'? 'sr-RS-Standard-A':'sr-RS-Standard-A';break;\n case \"Slovak\": this.voice = mf=='Male'? 'sk-SK-Wavenet-A':'sk-SK-Standard-A';break;\n case \"Spanish(ES)\": this.voice = mf=='Male'?'Enrique':'Conchita';break;\n case \"Spanish(US)\": this.voice = mf=='Male'?'Miguel':'Penelope';break;\n case \"Swedish\": this.voice = mf=='Male'?'Astrid':'Astrid';break;\n case \"Turkish\": this.voice = mf=='Male'?'Filiz':'Filiz';break;\n case \"Welsh\": this.voice = mf=='Male'?'Gwyneth':'Gwyneth';break;\n default: voice = mf=='Male'?'Brian':'Amy';\n}\n\n\n//we replace tags with markers to survive going into a URL and out again\n//usetext = usetext.replace(/</gi, \"PPPP\");\n//usetext = usetext.replace(/>/gi, \"dddd\");\n\nvar datastring= @@format@@ + '|' + voice + '|' + usetext;\nvar format = @@format@@;\n\nfetch_polly_url(usetext,voice,format,function(audiourl){\n theplayer.attr('src',audiourl);\n }\n);\n\n","style":"","dataset":"","datasetvars":"","alternate":"","alternateend":""} |