|
|
|
แก้ยังไงครับ Failed to load because no supported source was found. |
|
|
|
|
|
|
|
GETCode (XML)
https://translate.google.com/translate_tts?ie=UTF-8&prev=input&total=1&idx=0&client=tw-ob&ttsspeed=1&&inputm=2&otf=2&iid=1dd3b944-fa62-4b55-b330-74909a99969e&tl=th&q=Hello World&textlen=13&idx=0&total=1
404
(index):1 Uncaught (in promise) DOMException: Failed to load because no supported source was found.
API Google tts: https://github.com/hiddentao/google-tts
Code (JavaScript)
function readMessage(message){
$(document).ready(function(){
soundManager.setup({
url: '/',
preferFlash: false,
onready: function() {
var googleTTS = new window.GoogleTTS();
googleTTS.play(message, 'th', function(err) {
if (err) {
console.log('Cannot to play sound.');
}
updateAlert();
});
}
});
});
}
Code (JavaScript)
self.urls = function(txt, lang) {
lang = lang || self.defaultLanguage;
if (!txt || 0 >= txt.length)
throw new Error('Need some text');
var slices = self._sliceInput(txt, MAX_CHARS_PER_REQUEST),
urls = [];
for (var i=0; i<slices.length; ++i) {
var slice = slices[i];
urls.push(
'https://translate.google.com/translate_tts?ie=UTF-8&prev=input&total=1&idx=0&client=tw-ob&ttsspeed=1&&inputm=2&otf=2&iid=1dd3b944-fa62-4b55-b330-74909a99969e&tl=' + lang + '&q=' + encodeURIComponent(slice) + '&textlen=' + slice.length + '&idx=' + i + '&total=' + slices.length
);
}
return urls;
};
Tag : Java, HTML5, JavaScript, Web API, Google Chrome
|
|
|
|
|
|
Date :
2018-12-08 21:43:49 |
By :
Tachi |
View :
1934 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
...
|
|
|
|
|
Date :
2018-12-16 00:05:40 |
By :
Tachi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|