mirror of https://github.com/vector-im/riot-web
Merge pull request #5495 from matrix-org/dbkr/callhandler_unregister_dispatcher
Unregister from the dispatcher in CallHandlerpull/21833/head
commit
c03854729c
|
@ -118,6 +118,7 @@ function getRemoteAudioElement(): HTMLAudioElement {
|
|||
export default class CallHandler {
|
||||
private calls = new Map<string, MatrixCall>(); // roomId -> call
|
||||
private audioPromises = new Map<AudioID, Promise<void>>();
|
||||
private dispatcherRef: string = null;
|
||||
|
||||
static sharedInstance() {
|
||||
if (!window.mxCallHandler) {
|
||||
|
@ -128,7 +129,7 @@ export default class CallHandler {
|
|||
}
|
||||
|
||||
start() {
|
||||
dis.register(this.onAction);
|
||||
this.dispatcherRef = dis.register(this.onAction);
|
||||
// add empty handlers for media actions, otherwise the media keys
|
||||
// end up causing the audio elements with our ring/ringback etc
|
||||
// audio clips in to play.
|
||||
|
@ -151,6 +152,10 @@ export default class CallHandler {
|
|||
if (cli) {
|
||||
cli.removeListener('Call.incoming', this.onCallIncoming);
|
||||
}
|
||||
if (this.dispatcherRef !== null) {
|
||||
dis.unregister(this.dispatcherRef);
|
||||
this.dispatcherRef = null;
|
||||
}
|
||||
}
|
||||
|
||||
private onCallIncoming = (call) => {
|
||||
|
|
Loading…
Reference in New Issue