Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting PCM data from MediaStream on the Node.JS side #1091

Open
infinityp913 opened this issue Jun 9, 2023 · 0 comments
Open

Extracting PCM data from MediaStream on the Node.JS side #1091

infinityp913 opened this issue Jun 9, 2023 · 0 comments
Labels
client related to peerjs client

Comments

@infinityp913
Copy link

infinityp913 commented Jun 9, 2023

Hi! Thanks @afrokick for the NodeJS support (#928), this is super useful!!
Is there a way to extract pcm data from the MediaStream that is received on the node end?

MediaRecorder is helpful for it on the browser side but I couldn't find a Node port for it.

const mediaRecorder = new MediaRecorder(remote_stream, {
  audioBitsPerSecond: 16000, 
});
mediaRecorder.ondataavailable = handleDataAvailable;

function handleDataAvailable(event) {
  console.log("data-available");
  if (event.data.size > 0) {
    console.log("data > 0!");
    recordedChunks.push(event.data);
  } else {
    console.log("data <= 0");
  }
console.log(recordedChunks);
}
@irgalamarr irgalamarr added the client related to peerjs client label Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client related to peerjs client
Projects
None yet
Development

No branches or pull requests

2 participants