amouniverso / ie-activex-voicerec

ActiveX control for IE11 to sample an audio stream from a mic to a base64 string
MIT License
4 stars 3 forks source link

About callback between JavaScript and this plug-in #3

Open jty016 opened 4 years ago

jty016 commented 4 years ago

Thank you for your repo.

I'd like to send real-time audio from the host machine to the other server with IE11 browser. With this plug-in I can record and send the recorded audio when the recording is finished. For real-time audio, however, I think I have to define somewhat different ActiveX Control class.

Could you let me know how can I approach for this task?

Thank you in advance

amouniverso commented 4 years ago

Basically, you have two options for the task:

  1. ActiveX Controls have a built-in event functionality accessible from cliend-side javascript. To give you an idea:

    <script for="MyControl" event="ReceiveMessage(msg)">
    alert(msg);
    </script>

    Also you should implement and call the ReceiveMessage() method with audio chunks from PortAudio API on the C++ backend side.

  2. Use of a ringbuffer https://en.wikipedia.org/wiki/Circular_buffer for a temporary chunks storage, then polling that storage from a javascript.