versatica / JsSIP

JsSIP, the JavaScript SIP library
https://jssip.net
Other
2.4k stars 739 forks source link

Error when getting video track status on Firefox #839

Open dragos-boisteanu opened 9 months ago

dragos-boisteanu commented 9 months ago

When I use session.connection.getStats(videoTrack) I am receiving the following error: DOMException: track must be associated with a unique sender or receiver, but is associated with 0 senders and 0 receivers.

This only happens on Firefox, on Edge, Chrome and Electron it works well

Here is how I use the method.

session.connection.ontrack = async function (event) {
      session.connection.ontrack = null

      const stream = event.streams[0]
      const videoTracks = stream.getVideoTracks()

      remoteAudio.srcObject = stream
      remoteAudio.play()

      const stats = await session.connection.getStats(videoTrack)
      ....
}

Thank you