i will answer my question
what i did and working fine is to usning event in ontrackEvent and accessing the transceiver on both lacal and remote with
for remote peer
and for sending just reverse the direction and send what u need
yourConn2.ontrack = await e => {
/* do something with e.track */
//receive here
if (e.transceiver.receiver.track) {
remoteVideo = document.getElementById("wbrtcremote");
transceiversRemotePeer = new
MediaStream([e.transceiver.receiver.track]);
remoteVideo.srcObject = transceiversRemotePeer
}
//send here
e.transceiver.direction = 'sendrecv';
await e.transceiver.sender.replaceTrack(localstream);
};
for more details about how u can do it and why u need to reverse direction to
e.transceiver.direction = 'sendrecv';
that because on the receiver side(yourConn2), the direction is "downgraded" from sendrecv to recvonly because by default this transceiver is not configured to send anything back from receiverPc(yourConn2) to senderPc(yourConn).
After all, it was just created in response to setRemoteDescription(offer). To fix this, you "upgrade" the direction to sendrecv and set a track to send.
like so as above
e.transceiver.direction = 'sendrecv';
e.transceiver.sender.replaceTrack(localStream.getAudioTracks()[0]).then(() => {
});
If you do this prior to creating the local SDP answer on receiverPc, you should be able to achieve "sendrecv" without more SDP negotiations. The ontrack event is fired before the SRD promise is resolved, so any modification you do in that event should have completed before the SDP answer is created.