Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,7 @@ export class MatrixClient extends EventEmitter {
public async createGroupCall(
roomId: string,
type: GroupCallType,
isPtt, boolean,
intent: GroupCallIntent,
dataChannelsEnabled?: boolean,
dataChannelOptions?: IGroupCallDataChannelOptions,
Expand All @@ -1340,6 +1341,7 @@ export class MatrixClient extends EventEmitter {
this,
room,
type,
isPtt,
intent,
undefined,
dataChannelsEnabled,
Expand Down
9 changes: 8 additions & 1 deletion src/webrtc/groupCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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({
Expand All @@ -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,
});

Expand Down
3 changes: 3 additions & 0 deletions src/webrtc/groupCallEventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export class GroupCallEventHandler {
return;
}

const isPtt = Boolean(content["io.element.ptt"]);

let dataChannelOptions: IGroupCallDataChannelOptions | undefined;

if (content?.dataChannelsEnabled && content?.dataChannelOptions) {
Expand All @@ -105,6 +107,7 @@ export class GroupCallEventHandler {
this.client,
room,
callType,
isPtt,
callIntent,
groupCallId,
content?.dataChannelsEnabled,
Expand Down