php-docs-samples
php-docs-samples copied to clipboard
Speech streaming sample should have separate request and response handlers
Currently the speech streaming sample just reads a file, sends it, and waits for a response (all serially). But the streaming api is mainly useful for bidi streaming - ie one thread sends the audio in chunks, and one thread listens for dynamic responses. stackoverflow seems to think that php can handle threads, so it'd be nice to get the sample to demonstrate this capability.
Ideally it'd also get the audio from a live source (like a microphone) ^_^ But I'd settle for chunking up an audio file and sending the audio piece by piece (in its own thread). I think the most likely use case is for the php script to receive live audio sent by a browser over a websocket, sending transcripts over the same websocket as it gets them.