mirror of
https://github.com/vector-im/element-call.git
synced 2026-09-01 21:25:18 +00:00
Add media hints for notification events.
This commit is contained in:
@@ -8,7 +8,10 @@ Please see LICENSE in the repository root for full details.
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { useLocation } from "react-router-dom";
|
import { useLocation } from "react-router-dom";
|
||||||
import { logger } from "matrix-js-sdk/lib/logger";
|
import { logger } from "matrix-js-sdk/lib/logger";
|
||||||
import { type RTCNotificationType } from "matrix-js-sdk/lib/matrixrtc";
|
import {
|
||||||
|
RTCMediaHint,
|
||||||
|
type RTCNotificationType,
|
||||||
|
} from "matrix-js-sdk/lib/matrixrtc";
|
||||||
import { pickBy } from "lodash-es";
|
import { pickBy } from "lodash-es";
|
||||||
|
|
||||||
import { Config } from "./config/Config";
|
import { Config } from "./config/Config";
|
||||||
@@ -26,7 +29,9 @@ export enum UserIntent {
|
|||||||
StartNewCall = "start_call",
|
StartNewCall = "start_call",
|
||||||
JoinExistingCall = "join_existing",
|
JoinExistingCall = "join_existing",
|
||||||
StartNewCallDM = "start_call_dm",
|
StartNewCallDM = "start_call_dm",
|
||||||
|
StartNewCallDMVoice = "start_call_dm_voice",
|
||||||
JoinExistingCallDM = "join_existing_dm",
|
JoinExistingCallDM = "join_existing_dm",
|
||||||
|
JoinExistingCallDMVoice = "join_existing_dm_voice",
|
||||||
Unknown = "unknown",
|
Unknown = "unknown",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,6 +232,8 @@ export interface UrlConfiguration {
|
|||||||
* - auto-dismiss the call widget once the notification lifetime expires on the receivers side.
|
* - auto-dismiss the call widget once the notification lifetime expires on the receivers side.
|
||||||
*/
|
*/
|
||||||
waitForCallPickup: boolean;
|
waitForCallPickup: boolean;
|
||||||
|
|
||||||
|
mediaHint?: RTCMediaHint;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If you need to add a new flag to this interface, prefer a name that describes
|
// If you need to add a new flag to this interface, prefer a name that describes
|
||||||
@@ -365,12 +372,14 @@ export const getUrlParams = (
|
|||||||
intentPreset = {
|
intentPreset = {
|
||||||
...inAppDefault,
|
...inAppDefault,
|
||||||
skipLobby: true,
|
skipLobby: true,
|
||||||
|
mediaHint: "video",
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case UserIntent.JoinExistingCall:
|
case UserIntent.JoinExistingCall:
|
||||||
intentPreset = {
|
intentPreset = {
|
||||||
...inAppDefault,
|
...inAppDefault,
|
||||||
skipLobby: false,
|
skipLobby: false,
|
||||||
|
mediaHint: "video",
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case UserIntent.StartNewCallDM:
|
case UserIntent.StartNewCallDM:
|
||||||
@@ -379,6 +388,16 @@ export const getUrlParams = (
|
|||||||
skipLobby: true,
|
skipLobby: true,
|
||||||
autoLeaveWhenOthersLeft: true,
|
autoLeaveWhenOthersLeft: true,
|
||||||
waitForCallPickup: true,
|
waitForCallPickup: true,
|
||||||
|
mediaHint: "video",
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case UserIntent.StartNewCallDMVoice:
|
||||||
|
intentPreset = {
|
||||||
|
...inAppDefault,
|
||||||
|
skipLobby: true,
|
||||||
|
autoLeaveWhenOthersLeft: true,
|
||||||
|
waitForCallPickup: true,
|
||||||
|
mediaHint: "audio",
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case UserIntent.JoinExistingCallDM:
|
case UserIntent.JoinExistingCallDM:
|
||||||
@@ -386,6 +405,15 @@ export const getUrlParams = (
|
|||||||
...inAppDefault,
|
...inAppDefault,
|
||||||
skipLobby: true,
|
skipLobby: true,
|
||||||
autoLeaveWhenOthersLeft: true,
|
autoLeaveWhenOthersLeft: true,
|
||||||
|
mediaHint: "video",
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case UserIntent.JoinExistingCallDMVoice:
|
||||||
|
intentPreset = {
|
||||||
|
...inAppDefault,
|
||||||
|
skipLobby: true,
|
||||||
|
autoLeaveWhenOthersLeft: true,
|
||||||
|
mediaHint: "audio",
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
// Non widget usecase defaults
|
// Non widget usecase defaults
|
||||||
|
|||||||
@@ -120,11 +120,15 @@ export async function enterRTCSession(
|
|||||||
const { features, matrix_rtc_session: matrixRtcSessionConfig } = Config.get();
|
const { features, matrix_rtc_session: matrixRtcSessionConfig } = Config.get();
|
||||||
const useDeviceSessionMemberEvents =
|
const useDeviceSessionMemberEvents =
|
||||||
features?.feature_use_device_session_member_events;
|
features?.feature_use_device_session_member_events;
|
||||||
|
const { sendNotificationType: notificationType, mediaHint } = getUrlParams();
|
||||||
rtcSession.joinRoomSession(
|
rtcSession.joinRoomSession(
|
||||||
await makePreferredLivekitFoci(rtcSession, livekitAlias),
|
await makePreferredLivekitFoci(rtcSession, livekitAlias),
|
||||||
makeActiveFocus(),
|
makeActiveFocus(),
|
||||||
{
|
{
|
||||||
notificationType: getUrlParams().sendNotificationType,
|
notification: notificationType && {
|
||||||
|
type: notificationType,
|
||||||
|
hint: mediaHint,
|
||||||
|
},
|
||||||
useNewMembershipManager,
|
useNewMembershipManager,
|
||||||
manageMediaKeys: encryptMedia,
|
manageMediaKeys: encryptMedia,
|
||||||
...(useDeviceSessionMemberEvents !== undefined && {
|
...(useDeviceSessionMemberEvents !== undefined && {
|
||||||
|
|||||||
Reference in New Issue
Block a user