Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
websockets-streaming-audio
Advanced tools
Click a browser button to launch a node.js process on the server side which streams audio using web sockets back to the browser which is then rendered using web audio API My plan is to make this modular enough to get added to your process as simple API
Stream audio to a Web Audio API enabled browser from Node.js server side using Web Worker and Web Socket.
My plan is to make this modular enough to get added to your process as simple API calls - using Angularjs ;-)
I have now introduced a Web Worker to handle all server side calls - this fixed glitches of early versions suffered due to the single threaded browser - This outlines the flow of control :
Browser <--> Web Worker <--> Web Socket <--> Node.js
mode 1 Fill up audio queue on browser by requesting server side to start streaming the media file and return floating point typed array buffers via Web Worker using Web Sockets - transition to mode 2 when browser queue is full
mode 2 Browser renders audio using Web Audio API by consuming buffers from browser buffer queue. Simultaneously, the Web Worker is told to replenish its own WW side audio buffer queue by requesting buffers from Node.js server side using Web Socket - transition to mode 3 when browser buffer queue gets too low
mode 3 Browser seamlessly continues to render audio by consuming its same browser buffer queue. Web Worker does not interact with Node.js server side in this mode (critical to avoid interruptions). Web Worker begins this mode with a full buffer queue replinished during mode 2. Driven from the Web Audio API event loop callback, browser requests WW to send typed array audio buffers which refills its browser buffer queue at twice its consumption rate. - transition to mode 2 when browser audio buffer queue is full
[https://github.com/scottstensland/websockets-streaming-audio](github repo)
visit nodejs.org and install node.js
see project npm site at
https://www.npmjs.org/package/websockets-streaming-audio
Clone this repository to your local machine:
npm install websockets-streaming-audio
Change directory into the project folder websockets-streaming-audio
Then install the dependent modules:
npm install
Launch the nodejs app:
npm start
Using a Web Audio API savvy browser (ff/chrome), point it at URL :
http://localhost:8888
now in your browser (firefox/chrome) click stream_audio
or ignore above and just see this WebGL app deployed live on heroku :
http://websockets-streaming-audio.herokuapp.com
Current Limitations - server side source media parser I wrote only handles WAV format, however now that I am using Web Worker I could transition to a compressed format. The bloated ogg decoder enabled using emscripten may go in soon dunno. - I am not a front end developer so please click reload in between each stream button hit until I teach myself Angularjs ;-)))
Lessions Learned - To stream using Web Audio API you must offload Web Socket calls to the server side by the introduction of a Web Worker layer
Feel free to contact me on twitter if you have any questions! :) @scottstensland
FAQs
Click a browser button to launch a node.js process on the server side which streams audio using web sockets back to the browser which is then rendered using web audio API My plan is to make this modular enough to get added to your process as simple API
The npm package websockets-streaming-audio receives a total of 101 weekly downloads. As such, websockets-streaming-audio popularity was classified as not popular.
We found that websockets-streaming-audio demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.