Downloading audio file from translate.google.com
I am trying to develop an extension for Chrome. I can access the audio content at translate.google.com, but I want the content to play in a loop. I am using the Audio element in HTML5. I can't get it to loop using event handlers for "ended" event, or the simple loop attribute, unless I download the mp3. I noticed that even a url like: http://translate.google.com/tra开发者_开发知识库nslate_tts?q=sweet+ness in its native form has trouble replaying (Once the audio stops, try moving the slider all the way back and hit play again. It doesn't work, not for me anyway.) Does anyone know what causes that? Just curious.
Either way, I shouldn't be hitting Google's servers in a loop for the same request. How could I download the mp3 file from the extension? The text for the audio will change often enough that I can't download all the files manually.
Thanks!
I open link in browser(chromium): http://translate.google.com/translate_tts?ie=UTF-8&q=Hello%20world&tl=en&total=1&idx=0&textlen=16&prev=input, then save as mp3 file.
IMO , best way is to use some kind of proxy setup.. may be download the audio using some php ,what ever and use that as source..
精彩评论