qasim9872 / aws-transcribe

A client for Amazon Transcribe using the websockets API
https://www.npmjs.com/package/aws-transcribe
MIT License
10 stars 15 forks source link

Browser support? #1

Open rydash opened 4 years ago

rydash commented 4 years ago

Hi there! Lemme start by saying I'm in love with the idea of this library.

I want to create a StreamingClient from a browser, but I'm encountering errors that suggest this can't be done anywhere except Node yet.

First, src/aws-message-utils gets a TextDecoder from Node's util module. Unfortunately, something else in my project relies on the node-util package which gets imported instead. That package's current version doesn't include TextDecoder support.

Second (and perhaps more important), you're using the ws package, which explicitly mentions it won't work in a browser, and to use the browser's native WebSocket object instead.

I wish I had solutions to offer instead of just problems; adding isomorphic support is pretty new to me. If this is something you want to pursue, I can get a test project together that demonstrates these issues!

qasim9872 commented 4 years ago

Hi, thanks for the feedback and for raising this issue.

My initial requirement when I made the library was to stream the audio from a server, and as such, I didn't test it using a browser. I have made some changes and they are currently in this https://github.com/qasim9872/aws-transcribe/tree/feature/browser-support.

I have also made a demo browser app that is using this branch for now and can be found https://github.com/qasim9872/aws-transcribe-browser-demo.

I haven't had a chance to update the test to reflect the changes, once I get around to making the updates, hopefully by next week, I'll merge the branch in master.

Let me know if this helps for now and if you face any issues with the branch

rydash commented 4 years ago

This seems to be working! I have an error-free WebSocket connection with Transcribe through a browser.

Thank you!

jnorris441 commented 4 years ago

Hmm the browser demo app doesn't seem to exist

qasim9872 commented 4 years ago

Here’s the repo for the browser demo: https://github.com/qasim9872/aws-transcribe-browser-demo

anilsamuel commented 3 years ago

It's not clear on how to run the browser demo. Please help

anilsamuel commented 3 years ago

This seems to be working! I have an error-free WebSocket connection with Transcribe through a browser.

Thank you!

@rydash : Could you please share the code to get the transcribe working from browser ?