Extract state event capabilities into a variable
This commit is contained in:
parent
5ef3b055ff
commit
2a1689009a
1 changed files with 12 additions and 10 deletions
|
@ -77,7 +77,16 @@ export async function initMatroskaClient(
|
||||||
if (!userId) throw new Error("User ID must be supplied");
|
if (!userId) throw new Error("User ID must be supplied");
|
||||||
if (!deviceId) throw new Error("Device ID must be supplied");
|
if (!deviceId) throw new Error("Device ID must be supplied");
|
||||||
|
|
||||||
// These are all the to-device event types the app uses
|
// These are all the event types the app uses
|
||||||
|
const sendState = [
|
||||||
|
{ eventType: EventType.GroupCallPrefix },
|
||||||
|
{ eventType: EventType.GroupCallMemberPrefix, stateKey: userId },
|
||||||
|
];
|
||||||
|
const receiveState = [
|
||||||
|
{ eventType: EventType.RoomMember },
|
||||||
|
{ eventType: EventType.GroupCallPrefix },
|
||||||
|
{ eventType: EventType.GroupCallMemberPrefix },
|
||||||
|
];
|
||||||
const sendRecvToDevice = [
|
const sendRecvToDevice = [
|
||||||
EventType.CallInvite,
|
EventType.CallInvite,
|
||||||
EventType.CallCandidates,
|
EventType.CallCandidates,
|
||||||
|
@ -98,15 +107,8 @@ export async function initMatroskaClient(
|
||||||
const client = createRoomWidgetClient(
|
const client = createRoomWidgetClient(
|
||||||
new WidgetApi(widgetId, new URL(parentUrl).origin),
|
new WidgetApi(widgetId, new URL(parentUrl).origin),
|
||||||
{
|
{
|
||||||
sendState: [
|
sendState,
|
||||||
{ eventType: EventType.GroupCallPrefix },
|
receiveState,
|
||||||
{ eventType: EventType.GroupCallMemberPrefix, stateKey: userId },
|
|
||||||
],
|
|
||||||
receiveState: [
|
|
||||||
{ eventType: EventType.RoomMember },
|
|
||||||
{ eventType: EventType.GroupCallPrefix },
|
|
||||||
{ eventType: EventType.GroupCallMemberPrefix },
|
|
||||||
],
|
|
||||||
sendToDevice: sendRecvToDevice,
|
sendToDevice: sendRecvToDevice,
|
||||||
receiveToDevice: sendRecvToDevice,
|
receiveToDevice: sendRecvToDevice,
|
||||||
turnServers: true,
|
turnServers: true,
|
||||||
|
|
Loading…
Reference in a new issue