Open MuneebAhmed568 opened 3 months ago
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;
}
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.
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????