SIP.js icon indicating copy to clipboard operation
SIP.js copied to clipboard

Unable to downgrade call form Video call to Audio call

Open MuneebAhmed568 opened this issue 2 years ago • 2 comments

File => /src/platform/web/session-description-handler/session-description-handler.ts

protected getLocalMediaStream(options?: SessionDescriptionHandlerOptions): Promise { // ignore constraint "downgrades" constraints.audio = constraints.audio || this.localMediaStreamConstraints.audio; constraints.video = constraints.video || this.localMediaStreamConstraints.video; }

Can you Explain why the developer doesn't allow to downgrade a call from Video to audio call

I SOLVED THIS ISSUE BY THIS

protected getLocalMediaStream(options?: SessionDescriptionHandlerOptions): Promise { // ignore constraint "downgrades" constraints.audio = constraints.audio; constraints.video = constraints.video; }

is this a security issue????

MuneebAhmed568 avatar Mar 25 '24 07:03 MuneebAhmed568

What to understand from the comment // ignore constraint "downgrades", this is something on purpose, now why? God only knows

I don't know if there is something in the core of the project that doesn't allow these 'downgrades', but if it is possible to perform these 'downgrades', it would be better to use the 'Nullish Coalescing Operator', because since the constraints are optional, they might not be passed

Example: If the constraints.audio is not passed, its value would be undefined, because in this case, we only want to change the video, so there should be no change in the audio state.

Example using the Nullish Coalescing Operator:

protected getLocalMediaStream(options?: SessionDescriptionHandlerOptions): Promise {
  constraints.audio = constraints.audio ?? this.localMediaStreamConstraints.audio;
  constraints.video = constraints.video ?? this.localMediaStreamConstraints.video;
}

leandl avatar Jun 19 '24 20:06 leandl

Thanks for your response. After some testing, I was able to solve this issue. There's no need to downgrade constraints. The solution is to simply stop the video track when it is not needed and replace the track when it needs to be added again. This approach maintains the integrity of the audio state and avoids unnecessary complexity with downgrading constraints.

MuneebAhmed568 avatar Jun 20 '24 09:06 MuneebAhmed568