Jquery Ajax stream audio in binary format
an audio file in various formats (mp3,ogg etc) stored in different servers with unique urls, the audio files are stored in binary format. All the files are create from a call to the ispeech.org api, for text to speech transform
And i have a simple html page with a div called play, is it possible to load the the audio file s开发者_高级运维omehow (maybe ajax) on dom ready and when the user click on play start playing the audio file? I can't use flash nor jquery plugins (such as jplayer) just pure jquery/js or html5 Any suggestions?
One example of a url of streaming audio is here
And the api documentation is here
If all you need to do is play a file, and html5 is OK, maybe take a look at HTML5 Audio:
http://www.w3schools.com/html5/html5_audio.asp
The src
attribute of the audio
element contains a URL. If you are already using something else to create the streaming MP3 file, and it has a URL, then you should be able to simply set that URL to the src
attribute.
精彩评论