Unregister from the dispatcher in CallHandler
otherwise you end up getting multiple place_call dispatches if you place a call after logging in
This commit is contained in:
parent
7998f79cdb
commit
a798772e80
1 changed files with 3 additions and 1 deletions
|
@ -118,6 +118,7 @@ function getRemoteAudioElement(): HTMLAudioElement {
|
||||||
export default class CallHandler {
|
export default class CallHandler {
|
||||||
private calls = new Map<string, MatrixCall>(); // roomId -> call
|
private calls = new Map<string, MatrixCall>(); // roomId -> call
|
||||||
private audioPromises = new Map<AudioID, Promise<void>>();
|
private audioPromises = new Map<AudioID, Promise<void>>();
|
||||||
|
private dispatcherRef: string;
|
||||||
|
|
||||||
static sharedInstance() {
|
static sharedInstance() {
|
||||||
if (!window.mxCallHandler) {
|
if (!window.mxCallHandler) {
|
||||||
|
@ -128,7 +129,7 @@ export default class CallHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
dis.register(this.onAction);
|
this.dispatcherRef = dis.register(this.onAction);
|
||||||
// add empty handlers for media actions, otherwise the media keys
|
// add empty handlers for media actions, otherwise the media keys
|
||||||
// end up causing the audio elements with our ring/ringback etc
|
// end up causing the audio elements with our ring/ringback etc
|
||||||
// audio clips in to play.
|
// audio clips in to play.
|
||||||
|
@ -151,6 +152,7 @@ export default class CallHandler {
|
||||||
if (cli) {
|
if (cli) {
|
||||||
cli.removeListener('Call.incoming', this.onCallIncoming);
|
cli.removeListener('Call.incoming', this.onCallIncoming);
|
||||||
}
|
}
|
||||||
|
if (this.dispatcherRef) dis.unregister(this.dispatcherRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
private onCallIncoming = (call) => {
|
private onCallIncoming = (call) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue