0

guys I am having a problem in which I am trying to create a project that is working on peer to peer connection, When I have a connection between two peers and I addStream, I can hear the audio and stuff that is okay, But when I want to remove the stream it basically removes the whole peer and The connection is dead so they are not communicating anymore but what I want is to only remove the audioStream not the whole communication. So when I add the stream again it will just add the audio stream.

        video.pause();
        video.removeAttribute('src'); // empty source
        jquery(video).remove();
        peer.removeStream(mediaStream);
bzzzzzz
  • 88
  • 1
  • 12

1 Answers1

-2

Hmm not pretty sure what u are trying to do, but for removing only the audio track u need to do something like this

peer.removeTrack(stream.getAudioTracks()[0], stream);

it's taking from the official docs

Adrita Sharma
  • 21,581
  • 10
  • 69
  • 79