mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-08 20:09:19 +00:00
add media key debugging option
This commit is contained in:
@@ -152,6 +152,7 @@
|
|||||||
"preferences_tab_h4": "Preferences",
|
"preferences_tab_h4": "Preferences",
|
||||||
"preferences_tab_show_hand_raised_timer_description": "Show a timer when a participant raises their hand",
|
"preferences_tab_show_hand_raised_timer_description": "Show a timer when a participant raises their hand",
|
||||||
"preferences_tab_show_hand_raised_timer_label": "Show hand raise duration",
|
"preferences_tab_show_hand_raised_timer_label": "Show hand raise duration",
|
||||||
|
"show_media_keys": "Show media encryption keys",
|
||||||
"speaker_device_selection_label": "Speaker"
|
"speaker_device_selection_label": "Speaker"
|
||||||
},
|
},
|
||||||
"star_rating_input_label_one": "{{count}} stars",
|
"star_rating_input_label_one": "{{count}} stars",
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import {
|
|||||||
developerSettingsTab as developerSettingsTabSetting,
|
developerSettingsTab as developerSettingsTabSetting,
|
||||||
duplicateTiles as duplicateTilesSetting,
|
duplicateTiles as duplicateTilesSetting,
|
||||||
nonMemberTiles as nonMemberTilesSetting,
|
nonMemberTiles as nonMemberTilesSetting,
|
||||||
|
showMediaKeys as showMediaKeysSetting,
|
||||||
useOptInAnalytics,
|
useOptInAnalytics,
|
||||||
} from "./settings";
|
} from "./settings";
|
||||||
import { isFirefox } from "../Platform";
|
import { isFirefox } from "../Platform";
|
||||||
@@ -71,6 +72,8 @@ export const SettingsModal: FC<Props> = ({
|
|||||||
|
|
||||||
const [nonMemberTiles, setNonMemberTiles] = useSetting(nonMemberTilesSetting);
|
const [nonMemberTiles, setNonMemberTiles] = useSetting(nonMemberTilesSetting);
|
||||||
|
|
||||||
|
const [showMediaKeys, setShowMediaKeys] = useSetting(showMediaKeysSetting);
|
||||||
|
|
||||||
// Generate a `SelectInput` with a list of devices for a given device kind.
|
// Generate a `SelectInput` with a list of devices for a given device kind.
|
||||||
const generateDeviceSelection = (
|
const generateDeviceSelection = (
|
||||||
devices: MediaDevice,
|
devices: MediaDevice,
|
||||||
@@ -253,6 +256,20 @@ export const SettingsModal: FC<Props> = ({
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</FieldRow>
|
</FieldRow>
|
||||||
|
<FieldRow>
|
||||||
|
<InputField
|
||||||
|
id="showMediaKeys"
|
||||||
|
type="checkbox"
|
||||||
|
label={t("settings.show_media_keys")}
|
||||||
|
checked={showMediaKeys}
|
||||||
|
onChange={useCallback(
|
||||||
|
(event: ChangeEvent<HTMLInputElement>): void => {
|
||||||
|
setShowMediaKeys(event.target.checked);
|
||||||
|
},
|
||||||
|
[setShowMediaKeys],
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</FieldRow>
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -72,7 +72,9 @@ export const developerSettingsTab = new Setting(
|
|||||||
|
|
||||||
export const duplicateTiles = new Setting("duplicate-tiles", 0);
|
export const duplicateTiles = new Setting("duplicate-tiles", 0);
|
||||||
|
|
||||||
export const nonMemberTiles = new Setting("non-member-tiles", true);
|
export const nonMemberTiles = new Setting("non-member-tiles", false);
|
||||||
|
|
||||||
|
export const showMediaKeys = new Setting("non-member-tiles", false);
|
||||||
|
|
||||||
export const audioInput = new Setting<string | undefined>(
|
export const audioInput = new Setting<string | undefined>(
|
||||||
"audio-input",
|
"audio-input",
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import {
|
|||||||
MatrixRTCSession,
|
MatrixRTCSession,
|
||||||
MatrixRTCSessionEvent,
|
MatrixRTCSessionEvent,
|
||||||
} from "matrix-js-sdk/src/matrixrtc";
|
} from "matrix-js-sdk/src/matrixrtc";
|
||||||
import { logger } from "matrix-js-sdk/src/logger";
|
|
||||||
|
|
||||||
import { ViewModel } from "./ViewModel";
|
import { ViewModel } from "./ViewModel";
|
||||||
import { useReactiveState } from "../useReactiveState";
|
import { useReactiveState } from "../useReactiveState";
|
||||||
@@ -221,18 +220,22 @@ abstract class BaseUserMediaViewModel extends BaseMediaViewModel {
|
|||||||
Track.Source.Camera,
|
Track.Source.Camera,
|
||||||
);
|
);
|
||||||
|
|
||||||
// rtcSession.on(
|
combineLatest([
|
||||||
// MatrixRTCSessionEvent.EncryptionKeyChanged,
|
participant,
|
||||||
// (key, index, participantId) => {
|
fromEvent(rtcSession, MatrixRTCSessionEvent.EncryptionKeyChanged).pipe(
|
||||||
// if (id.startsWith(participantId))
|
startWith(null),
|
||||||
// logger.info("got new keys: ", participant, { index, key });
|
),
|
||||||
// logger.info("All keys for participant ", participant, " - ", [
|
]).subscribe(([par, ev]) => {
|
||||||
// ...this.keys.value,
|
for (const participantKeys of rtcSession.getEncryptionKeys()) {
|
||||||
// { index, key },
|
if (participantKeys[0] === par?.identity) {
|
||||||
// ]);
|
this.keys.next(
|
||||||
// this.keys.next([...this.keys.value, { index, key }]);
|
Array.from(participantKeys[1].entries()).map(([i, k]) => {
|
||||||
// },
|
return { index: i, key: k };
|
||||||
// );
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const media = participant.pipe(
|
const media = participant.pipe(
|
||||||
switchMap((p) => (p && observeParticipantMedia(p)) ?? of(undefined)),
|
switchMap((p) => (p && observeParticipantMedia(p)) ?? of(undefined)),
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ Please see LICENSE in the repository root for full details.
|
|||||||
|
|
||||||
import { TrackReferenceOrPlaceholder } from "@livekit/components-core";
|
import { TrackReferenceOrPlaceholder } from "@livekit/components-core";
|
||||||
import { animated } from "@react-spring/web";
|
import { animated } from "@react-spring/web";
|
||||||
import { RoomMember } from "matrix-js-sdk/src/matrix";
|
import { encodeUnpaddedBase64, RoomMember } from "matrix-js-sdk/src/matrix";
|
||||||
import { ComponentProps, ReactNode, forwardRef } from "react";
|
import { ComponentProps, FC, ReactNode, forwardRef } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { VideoTrack } from "@livekit/components-react";
|
import { VideoTrack } from "@livekit/components-react";
|
||||||
@@ -18,7 +18,11 @@ import { ErrorIcon } from "@vector-im/compound-design-tokens/assets/web/icons";
|
|||||||
import styles from "./MediaView.module.css";
|
import styles from "./MediaView.module.css";
|
||||||
import { Avatar } from "../Avatar";
|
import { Avatar } from "../Avatar";
|
||||||
import { RaisedHandIndicator } from "../reactions/RaisedHandIndicator";
|
import { RaisedHandIndicator } from "../reactions/RaisedHandIndicator";
|
||||||
import { showHandRaisedTimer, useSetting } from "../settings/settings";
|
import {
|
||||||
|
showHandRaisedTimer,
|
||||||
|
showMediaKeys as showMediaKeysSettings,
|
||||||
|
useSetting,
|
||||||
|
} from "../settings/settings";
|
||||||
|
|
||||||
interface Props extends ComponentProps<typeof animated.div> {
|
interface Props extends ComponentProps<typeof animated.div> {
|
||||||
className?: string;
|
className?: string;
|
||||||
@@ -62,6 +66,7 @@ export const MediaView = forwardRef<HTMLDivElement, Props>(
|
|||||||
) => {
|
) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [handRaiseTimerVisible] = useSetting(showHandRaisedTimer);
|
const [handRaiseTimerVisible] = useSetting(showHandRaisedTimer);
|
||||||
|
const [showMediaKeys] = useSetting(showMediaKeysSettings);
|
||||||
|
|
||||||
const avatarSize = Math.round(Math.min(targetWidth, targetHeight) / 2);
|
const avatarSize = Math.round(Math.min(targetWidth, targetHeight) / 2);
|
||||||
|
|
||||||
@@ -100,12 +105,7 @@ export const MediaView = forwardRef<HTMLDivElement, Props>(
|
|||||||
minature={avatarSize < 96}
|
minature={avatarSize < 96}
|
||||||
showTimer={handRaiseTimerVisible}
|
showTimer={handRaiseTimerVisible}
|
||||||
/>
|
/>
|
||||||
{/* {keys &&
|
{keys && showMediaKeys && <MediaKeyList keys={keys} />}
|
||||||
keys.map(({ index, key }) => (
|
|
||||||
<Text as="span" size="sm">
|
|
||||||
index:{index}, key:{key}
|
|
||||||
</Text>
|
|
||||||
))} */}
|
|
||||||
<div className={styles.nameTag}>
|
<div className={styles.nameTag}>
|
||||||
{nameTagLeadingIcon}
|
{nameTagLeadingIcon}
|
||||||
<Text as="span" size="sm" weight="medium" className={styles.name}>
|
<Text as="span" size="sm" weight="medium" className={styles.name}>
|
||||||
@@ -132,5 +132,45 @@ export const MediaView = forwardRef<HTMLDivElement, Props>(
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
interface MediaKeyListProps {
|
||||||
|
keys: {
|
||||||
|
index: number;
|
||||||
|
key: Uint8Array;
|
||||||
|
}[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const MediaKeyList: FC<MediaKeyListProps> = ({ keys }) => {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
height: "70%",
|
||||||
|
overflow: "scroll",
|
||||||
|
color: "white",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{keys.map(({ index, key }) => (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
backgroundColor: "#000000c0",
|
||||||
|
margin: "3px",
|
||||||
|
padding: "5px",
|
||||||
|
borderRadius: "5px",
|
||||||
|
}}
|
||||||
|
key={index}
|
||||||
|
>
|
||||||
|
<Text as="span" size="sm">
|
||||||
|
index:{index}
|
||||||
|
</Text>
|
||||||
|
<Text as="span" size="xs">
|
||||||
|
key:{key ? encodeUnpaddedBase64(key) : "unavailable"}
|
||||||
|
</Text>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
MediaView.displayName = "MediaView";
|
MediaView.displayName = "MediaView";
|
||||||
|
|||||||
Reference in New Issue
Block a user