Skip to content

Commit

Permalink
Revert "Move sendOpcode call outside of promise creation"
Browse files Browse the repository at this point in the history
Due to some unknown causes, the event ends up firing before the handler is attached
  • Loading branch information
longnguyen2004 committed Feb 5, 2025
1 parent be8f806 commit 7f2c3e6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/client/voice/BaseMediaConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,16 @@ export abstract class BaseMediaConnection extends EventEmitter {
} else {
encryptionMode = SupportedEncryptionModes.XCHACHA20
}
this.sendOpcode(VoiceOpCodes.SELECT_PROTOCOL, {
protocol: "udp",
codecs: Object.values(CodecPayloadType) as ValueOf<typeof CodecPayloadType>[],
data: {
address: ip,
port: port,
mode: encryptionMode
}
});
return new Promise((resolve) => {
this.sendOpcode(VoiceOpCodes.SELECT_PROTOCOL, {
protocol: "udp",
codecs: Object.values(CodecPayloadType) as ValueOf<typeof CodecPayloadType>[],
data: {
address: ip,
port: port,
mode: encryptionMode
}
});
this.once("select_protocol_ack", () => resolve());
})
}
Expand Down

0 comments on commit 7f2c3e6

Please sign in to comment.