mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-08 20:09:19 +00:00
make delegation of delayed events optional depending on delayId
This commit is contained in:
@@ -35,6 +35,7 @@ export async function getSFUConfigWithOpenID(
|
|||||||
client: OpenIDClientParts,
|
client: OpenIDClientParts,
|
||||||
serviceUrl: string,
|
serviceUrl: string,
|
||||||
matrixRoomId: string,
|
matrixRoomId: string,
|
||||||
|
delayId: string,
|
||||||
): Promise<SFUConfig> {
|
): Promise<SFUConfig> {
|
||||||
let openIdToken: IOpenIDToken;
|
let openIdToken: IOpenIDToken;
|
||||||
try {
|
try {
|
||||||
@@ -54,6 +55,7 @@ export async function getSFUConfigWithOpenID(
|
|||||||
serviceUrl,
|
serviceUrl,
|
||||||
matrixRoomId,
|
matrixRoomId,
|
||||||
openIdToken,
|
openIdToken,
|
||||||
|
delayId,
|
||||||
);
|
);
|
||||||
logger.info(`Got JWT from call's active focus URL.`);
|
logger.info(`Got JWT from call's active focus URL.`);
|
||||||
|
|
||||||
@@ -65,26 +67,31 @@ async function getLiveKitJWT(
|
|||||||
livekitServiceURL: string,
|
livekitServiceURL: string,
|
||||||
roomName: string,
|
roomName: string,
|
||||||
openIDToken: IOpenIDToken,
|
openIDToken: IOpenIDToken,
|
||||||
|
delayId: string,
|
||||||
): Promise<SFUConfig> {
|
): Promise<SFUConfig> {
|
||||||
try {
|
try {
|
||||||
|
let body = {
|
||||||
|
room_id: roomName,
|
||||||
|
slot_id: "m.call#ROOM",
|
||||||
|
openid_token: openIDToken,
|
||||||
|
member: {
|
||||||
|
id: (client.getUserId() ?? "") + client.getDeviceId(),
|
||||||
|
claimed_user_id: client.getUserId(),
|
||||||
|
claimed_device_id: client.getDeviceId(),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (delayId) {
|
||||||
|
body = {
|
||||||
|
...body,
|
||||||
|
...{delay_id: delayId, delay_timeout: 10000, delay_cs_api_url: client.baseUrl}
|
||||||
|
}
|
||||||
|
};
|
||||||
const res = await fetch(livekitServiceURL + "/sfu/get", {
|
const res = await fetch(livekitServiceURL + "/sfu/get", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify(body),
|
||||||
room_id: roomName,
|
|
||||||
slot_id: "m.call#ROOM",
|
|
||||||
openid_token: openIDToken,
|
|
||||||
member: {
|
|
||||||
id: (client.getUserId() ?? "") + client.getDeviceId(),
|
|
||||||
claimed_user_id: client.getUserId(),
|
|
||||||
claimed_device_id: client.getDeviceId(),
|
|
||||||
},
|
|
||||||
delay_id: "12345",
|
|
||||||
delay_timeout: 10000,
|
|
||||||
delay_cs_api_url: client.baseUrl
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
throw new Error("SFU Config fetch failed with status code " + res.status);
|
throw new Error("SFU Config fetch failed with status code " + res.status);
|
||||||
|
|||||||
Reference in New Issue
Block a user