Skip to content

Commit

Permalink
Fix incorrect logic
Browse files Browse the repository at this point in the history
  • Loading branch information
longnguyen2004 committed Feb 5, 2025
1 parent 2b20a38 commit be8f806
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/client/voice/BaseMediaConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,6 @@ export abstract class BaseMediaConnection extends EventEmitter {
public setVideoAttributes(enabled: false): void
public setVideoAttributes(enabled: true, attr: VideoAttributes): void
public setVideoAttributes(enabled: boolean, attr?: VideoAttributes): void {
if (!(enabled && attr))
throw new Error("Need to specify video attributes");
if (!this.webRtcParams)
throw new Error("WebRTC connection not ready");
const { audioSsrc, videoSsrc, rtxSsrc } = this.webRtcParams;
Expand All @@ -354,6 +352,8 @@ export abstract class BaseMediaConnection extends EventEmitter {
streams: []
})
} else {
if (!attr)
throw new Error("Need to specify video attributes")
this.sendOpcode(VoiceOpCodes.VIDEO, {
audio_ssrc: audioSsrc,
video_ssrc: videoSsrc,
Expand Down

0 comments on commit be8f806

Please sign in to comment.