diff --git a/src/client.ts b/src/client.ts index 0885554872a..0fab62a30ae 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1322,6 +1322,7 @@ export class MatrixClient extends EventEmitter { public async createGroupCall( roomId: string, type: GroupCallType, + isPtt, boolean, intent: GroupCallIntent, dataChannelsEnabled?: boolean, dataChannelOptions?: IGroupCallDataChannelOptions, @@ -1340,6 +1341,7 @@ export class MatrixClient extends EventEmitter { this, room, type, + isPtt, intent, undefined, dataChannelsEnabled, diff --git a/src/webrtc/groupCall.ts b/src/webrtc/groupCall.ts index 45ccb6099cf..f648343129a 100644 --- a/src/webrtc/groupCall.ts +++ b/src/webrtc/groupCall.ts @@ -134,6 +134,7 @@ export class GroupCall extends EventEmitter { private client: MatrixClient, public room: Room, public type: GroupCallType, + public isPtt: boolean, public intent: GroupCallIntent, groupCallId?: string, private dataChannelsEnabled?: boolean, @@ -160,6 +161,7 @@ export class GroupCall extends EventEmitter { { "m.intent": this.intent, "m.type": this.type, + "io.element.ptt": this.isPtt, // TODO: Specify datachannels "dataChannelsEnabled": this.dataChannelsEnabled, "dataChannelOptions": this.dataChannelOptions, @@ -208,6 +210,11 @@ export class GroupCall extends EventEmitter { throw error; } + // start muted on ptt calls + if (this.isPtt) { + setTracksEnabled(stream.getAudioTracks(), false); + } + const userId = this.client.getUserId(); const callFeed = new CallFeed({ @@ -216,7 +223,7 @@ export class GroupCall extends EventEmitter { userId, stream, purpose: SDPStreamMetadataPurpose.Usermedia, - audioMuted: stream.getAudioTracks().length === 0, + audioMuted: stream.getAudioTracks().length === 0 || this.isPtt, videoMuted: stream.getVideoTracks().length === 0, }); diff --git a/src/webrtc/groupCallEventHandler.ts b/src/webrtc/groupCallEventHandler.ts index 99e726f1f1c..476d0acfabd 100644 --- a/src/webrtc/groupCallEventHandler.ts +++ b/src/webrtc/groupCallEventHandler.ts @@ -93,6 +93,8 @@ export class GroupCallEventHandler { return; } + const isPtt = Boolean(content["io.element.ptt"]); + let dataChannelOptions: IGroupCallDataChannelOptions | undefined; if (content?.dataChannelsEnabled && content?.dataChannelOptions) { @@ -105,6 +107,7 @@ export class GroupCallEventHandler { this.client, room, callType, + isPtt, callIntent, groupCallId, content?.dataChannelsEnabled,