I am adding tracks to my peer and the first time onnegotiationneeded is triggered just fine. However, upon adding more tracks onnegotiationneeded is not triggered therefore the new tracks are not showing any effect. This is the main part of the code I am working with :
const { id } = req.params
peer[id] = new webrtc.RTCPeerConnection()
const guest = { id, name: '', tracks: [], room }
guest.tracks.forEach(t => peer[host.id].addTrack(t))
const createNegotiation = async (peerID) => {
peer[peerID].onnegotiationneeded = async () => {
console.log('onnegotiationneededonnegotiationneeded')
const offer = await peer[peerID].createOffer()
await peer[peerID].setLocalDescription(offer)
dc.send(JSON.stringify({ type: 'onnegotiationneeded', "sdp": peer[peerID].localDescription }))
}
}