Janus videocall plugin: onTrack event not triggered on the sender's side when both sides use addTransceiver, causing sender not to see receiver's video (Janus v1.3.0, WebRTC: m 132)

Problem Description:

I’m using the Janus videocall plugin (Janus v1.3.0, WebRTC: m 132) and encountered an issue. When both sides use addTrack, the video call works as expected. However, when both sides switch to addTransceiver, the sender’s onTrack event is not triggered, causing the sender to not see the receiver’s video.

Analysis:

  • Both sides are using addTransceiver.
  • After calling addTransceiver on the receiver’s side, the SDP generated by createAnswer contains a=recvonly, which suggests that the direction for addTransceiver is expected to be sendrecv, but it doesn’t seem to be applied correctly.
  • The media direction in the SDP exchange seems correct, but the sender’s onTrack event does not trigger.

Solutions Tried:

  • Ensured that both sides’ addTransceiver configurations are correct and that the media direction is set to sendrecv.
  • Checked the SDP exchange process to verify that the direction attribute is correctly set.
  • Debugged the SDP to ensure that all necessary fields are passed correctly.

Request for Help:

Could there be any additional configuration or adjustments needed when using addTransceiver that would prevent the sender’s onTrack event from being triggered? Is this potentially an issue with the media direction in the SDP, or could there be another underlying configuration problem related to Janus v1.3.0 and WebRTC m 132?

Not sure what you’re trying, but janus.js (the small library our demos use) use transceivers internally. If the normal demo always works, you may want to check that janus.js does with transceivers, and do something similar if you want to handle JSEP APIs yourself.

I am implementing functionality similar to janus.js in Java. I noticed that the official Janus Android client is no longer maintained. In the video call plugin, when initiating a call, both capture and recv options can be set for audio and video. My understanding is that I should use config.pc.addTransceiver and specify the direction when adding the transceiver to support these capture and recv parameters.

When both sides use config.getPc().addTrack, the interaction works fine. However, when using config.pc.addTransceiver, the sender cannot see the receiver’s video. Upon inspecting the SDP generated by createAnswer on the receiver’s side, I found that the direction is set to a=recvonly, whereas when using config.getPc().addTrack, the direction in the SDP is a=sendrecv.