How to create voice recognition on gae site?
Here is the code to recognize flac file. But how can I record that with user's browser? (my site is for android and iphone)
class MainPage(webapp.RequestHandler):
def post(self):
destinationURL = "http://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=en-US"
result = urlfetch.fetch(url=destinationURL, payload= self.request.body, method=urlfetch.POST, header开发者_C百科s={'Content-Type': 'audio/x-flac; rate=16000'})
self.response.out.write(result.content)
Browser-side voice recording can only be done with java applets, which neither iPhone nor Android supports.
There is a possibility to record voice with Flash and RTMP server, but Flash only runs on (some) Android phones and RTMP servers do not run on GAE (since they require sockets).
The only way to make this work is to forget the browser and create native apps that record audio and upload it to GAE server via HTTP.
精彩评论