mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
@@ -112,6 +112,12 @@ interface UrlParams {
|
|||||||
* Token for a user for instance login. This is used for bridge gosts.
|
* Token for a user for instance login. This is used for bridge gosts.
|
||||||
*/
|
*/
|
||||||
token: string | null;
|
token: string | null;
|
||||||
|
/**
|
||||||
|
* Setting this flag skips the lobby and brings you in the call directly.
|
||||||
|
* In the widget this can be combined with preload to pass the device settings
|
||||||
|
* with the join widget action.
|
||||||
|
*/
|
||||||
|
skipLobby: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is here as a stopgap, but what would be far nicer is a function that
|
// This is here as a stopgap, but what would be far nicer is a function that
|
||||||
@@ -205,6 +211,7 @@ export const getUrlParams = (
|
|||||||
analyticsID: parser.getParam("analyticsID"),
|
analyticsID: parser.getParam("analyticsID"),
|
||||||
allowIceFallback: parser.getFlagParam("allowIceFallback"),
|
allowIceFallback: parser.getFlagParam("allowIceFallback"),
|
||||||
token: parser.getParam("token"),
|
token: parser.getParam("token"),
|
||||||
|
skipLobby: parser.getFlagParam("skipLobby"),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ interface Props {
|
|||||||
isPasswordlessUser: boolean;
|
isPasswordlessUser: boolean;
|
||||||
confineToRoom: boolean;
|
confineToRoom: boolean;
|
||||||
preload: boolean;
|
preload: boolean;
|
||||||
|
skipLobby: boolean;
|
||||||
hideHeader: boolean;
|
hideHeader: boolean;
|
||||||
rtcSession: MatrixRTCSession;
|
rtcSession: MatrixRTCSession;
|
||||||
}
|
}
|
||||||
@@ -69,6 +70,7 @@ export function GroupCallView({
|
|||||||
isPasswordlessUser,
|
isPasswordlessUser,
|
||||||
confineToRoom,
|
confineToRoom,
|
||||||
preload,
|
preload,
|
||||||
|
skipLobby,
|
||||||
hideHeader,
|
hideHeader,
|
||||||
rtcSession,
|
rtcSession,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
@@ -133,18 +135,17 @@ export function GroupCallView({
|
|||||||
latestMuteStates.current = muteStates;
|
latestMuteStates.current = muteStates;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (widget && preload) {
|
if (skipLobby) {
|
||||||
// In preload mode, wait for a join action before entering
|
// widget && preload
|
||||||
const onJoin = async (ev: CustomEvent<IWidgetApiRequest>) => {
|
const defaultDeviceSetup = async (
|
||||||
|
requestedDeviceData: JoinCallData
|
||||||
|
): Promise<void> => {
|
||||||
// XXX: I think this is broken currently - LiveKit *won't* request
|
// XXX: I think this is broken currently - LiveKit *won't* request
|
||||||
// permissions and give you device names unless you specify a kind, but
|
// permissions and give you device names unless you specify a kind, but
|
||||||
// here we want all kinds of devices. This needs a fix in livekit-client
|
// here we want all kinds of devices. This needs a fix in livekit-client
|
||||||
// for the following name-matching logic to do anything useful.
|
// for the following name-matching logic to do anything useful.
|
||||||
const devices = await Room.getLocalDevices(undefined, true);
|
const devices = await Room.getLocalDevices(undefined, true);
|
||||||
|
const { audioInput, videoInput } = requestedDeviceData;
|
||||||
const { audioInput, videoInput } = ev.detail
|
|
||||||
.data as unknown as JoinCallData;
|
|
||||||
|
|
||||||
if (audioInput === null) {
|
if (audioInput === null) {
|
||||||
latestMuteStates.current!.audio.setEnabled?.(false);
|
latestMuteStates.current!.audio.setEnabled?.(false);
|
||||||
} else {
|
} else {
|
||||||
@@ -184,27 +185,27 @@ export function GroupCallView({
|
|||||||
latestMuteStates.current!.video.setEnabled?.(true);
|
latestMuteStates.current!.video.setEnabled?.(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
// In preload mode, wait for a join action before entering
|
||||||
|
if (widget && preload) {
|
||||||
|
const onJoin = async (ev: CustomEvent<IWidgetApiRequest>) => {
|
||||||
|
defaultDeviceSetup(ev.detail.data as unknown as JoinCallData);
|
||||||
|
enterRTCSession(rtcSession);
|
||||||
|
await Promise.all([
|
||||||
|
widget!.api.setAlwaysOnScreen(true),
|
||||||
|
widget!.api.transport.reply(ev.detail, {}),
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
widget.lazyActions.on(ElementWidgetActions.JoinCall, onJoin);
|
||||||
|
return () => {
|
||||||
|
widget!.lazyActions.off(ElementWidgetActions.JoinCall, onJoin);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
defaultDeviceSetup({ audioInput: null, videoInput: null });
|
||||||
enterRTCSession(rtcSession);
|
enterRTCSession(rtcSession);
|
||||||
|
}
|
||||||
PosthogAnalytics.instance.eventCallEnded.cacheStartCall(new Date());
|
|
||||||
// we only have room sessions right now, so call ID is the emprty string - we use the room ID
|
|
||||||
PosthogAnalytics.instance.eventCallStarted.track(
|
|
||||||
rtcSession.room.roomId
|
|
||||||
);
|
|
||||||
|
|
||||||
await Promise.all([
|
|
||||||
widget!.api.setAlwaysOnScreen(true),
|
|
||||||
widget!.api.transport.reply(ev.detail, {}),
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
|
|
||||||
widget.lazyActions.on(ElementWidgetActions.JoinCall, onJoin);
|
|
||||||
return () => {
|
|
||||||
widget!.lazyActions.off(ElementWidgetActions.JoinCall, onJoin);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}, [rtcSession, preload]);
|
}, [rtcSession, preload, skipLobby]);
|
||||||
|
|
||||||
const [left, setLeft] = useState(false);
|
const [left, setLeft] = useState(false);
|
||||||
const [leaveError, setLeaveError] = useState<Error | undefined>(undefined);
|
const [leaveError, setLeaveError] = useState<Error | undefined>(undefined);
|
||||||
|
|||||||
@@ -30,8 +30,14 @@ import { platform } from "../Platform";
|
|||||||
import { AppSelectionModal } from "./AppSelectionModal";
|
import { AppSelectionModal } from "./AppSelectionModal";
|
||||||
|
|
||||||
export const RoomPage: FC = () => {
|
export const RoomPage: FC = () => {
|
||||||
const { confineToRoom, appPrompt, preload, hideHeader, displayName } =
|
const {
|
||||||
useUrlParams();
|
confineToRoom,
|
||||||
|
appPrompt,
|
||||||
|
preload,
|
||||||
|
hideHeader,
|
||||||
|
displayName,
|
||||||
|
skipLobby,
|
||||||
|
} = useUrlParams();
|
||||||
|
|
||||||
const { roomAlias, roomId, viaServers } = useRoomIdentifier();
|
const { roomAlias, roomId, viaServers } = useRoomIdentifier();
|
||||||
|
|
||||||
@@ -77,10 +83,11 @@ export const RoomPage: FC = () => {
|
|||||||
isPasswordlessUser={passwordlessUser}
|
isPasswordlessUser={passwordlessUser}
|
||||||
confineToRoom={confineToRoom}
|
confineToRoom={confineToRoom}
|
||||||
preload={preload}
|
preload={preload}
|
||||||
|
skipLobby={skipLobby}
|
||||||
hideHeader={hideHeader}
|
hideHeader={hideHeader}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
[client, passwordlessUser, confineToRoom, preload, hideHeader]
|
[client, passwordlessUser, confineToRoom, preload, hideHeader, skipLobby]
|
||||||
);
|
);
|
||||||
|
|
||||||
let content: ReactNode;
|
let content: ReactNode;
|
||||||
|
|||||||
Reference in New Issue
Block a user