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

change audio source input on the fly! #77

Open
Abdeladim101Basraoui opened this issue Sep 5, 2023 · 0 comments
Open

change audio source input on the fly! #77

Abdeladim101Basraoui opened this issue Sep 5, 2023 · 0 comments

Comments

@Abdeladim101Basraoui
Copy link

Abdeladim101Basraoui commented Sep 5, 2023

in my current scenarion I want to have the ability to change the audioTracks on the fly I found on the documentation that it's possible to do so for the audio Track ,but couldn't find resource for audio tracks ,I've been using webRTC native api and I did a solution to

  peerConnection.removeTrack(oldSender);

  const newSender = peerConnection.addTrack(track, stream);

  const localSdp = await peerConnection.createOffer({ offerToReceiveAudio: 1 });
  await peerConnection.setLocalDescription(reply);

  const response = await sendOffer(peerConnection.localDescription);

  const description = new RTCSessionDescription(response);
  peerConnection.setRemoteDescription(description);

  return newSender;
}

thank you

@Abdeladim101Basraoui Abdeladim101Basraoui changed the title change audio source input on the fly change audio source input on the fly! Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant