You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
Some little fixes to support line 1 / 2
* Resume playing audio at the appropriate time * Re-emit call events (they were the exception before - all other events were re-emitted through the MatrixClient) * Fix an audio/video typo
This commit is contained in:
@@ -457,9 +457,7 @@ export class MatrixCall extends EventEmitter {
|
|||||||
async setRemoteAudioElement(element: HTMLAudioElement) {
|
async setRemoteAudioElement(element: HTMLAudioElement) {
|
||||||
if (element === this.remoteAudioElement) return;
|
if (element === this.remoteAudioElement) return;
|
||||||
|
|
||||||
if (this.remoteVideoElement) this.remoteVideoElement.muted = true;
|
|
||||||
this.remoteAudioElement = element;
|
this.remoteAudioElement = element;
|
||||||
this.remoteAudioElement.muted = false;
|
|
||||||
|
|
||||||
if (this.remoteStream) this.playRemoteAudio();
|
if (this.remoteStream) this.playRemoteAudio();
|
||||||
}
|
}
|
||||||
@@ -686,6 +684,10 @@ export class MatrixCall extends EventEmitter {
|
|||||||
}
|
}
|
||||||
this.updateMuteStatus();
|
this.updateMuteStatus();
|
||||||
|
|
||||||
|
if (!onHold) {
|
||||||
|
this.playRemoteAudio();
|
||||||
|
}
|
||||||
|
|
||||||
this.emit(CallEvent.RemoteHoldUnhold, this.remoteOnHold);
|
this.emit(CallEvent.RemoteHoldUnhold, this.remoteOnHold);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1265,6 +1267,9 @@ export class MatrixCall extends EventEmitter {
|
|||||||
|
|
||||||
playRemoteAudio() {
|
playRemoteAudio() {
|
||||||
this.queueMediaOperation(MediaQueueId.RemoteAudio, async () => {
|
this.queueMediaOperation(MediaQueueId.RemoteAudio, async () => {
|
||||||
|
if (this.remoteVideoElement) this.remoteVideoElement.muted = true;
|
||||||
|
this.remoteAudioElement.muted = false;
|
||||||
|
|
||||||
this.remoteAudioElement.srcObject = this.remoteStream;
|
this.remoteAudioElement.srcObject = this.remoteStream;
|
||||||
|
|
||||||
// if audioOutput is non-default:
|
// if audioOutput is non-default:
|
||||||
@@ -1284,7 +1289,7 @@ export class MatrixCall extends EventEmitter {
|
|||||||
try {
|
try {
|
||||||
await this.remoteAudioElement.play();
|
await this.remoteAudioElement.play();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error("Failed to play remote video element", e);
|
logger.error("Failed to play remote audio element", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1628,5 +1633,9 @@ export function createNewMatrixCall(client: any, roomId: string, options?: CallO
|
|||||||
// call level options
|
// call level options
|
||||||
forceTURN: client._forceTURN || optionsForceTURN,
|
forceTURN: client._forceTURN || optionsForceTURN,
|
||||||
};
|
};
|
||||||
return new MatrixCall(opts);
|
const call = new MatrixCall(opts);
|
||||||
|
|
||||||
|
client.reEmitter.reEmit(call, Object.values(CallEvent));
|
||||||
|
|
||||||
|
return call;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user