@@ -7,8 +7,8 @@ Please see LICENSE in the repository root for full details.
7
7
8
8
import { TrackReferenceOrPlaceholder } from "@livekit/components-core" ;
9
9
import { animated } from "@react-spring/web" ;
10
- import { RoomMember } from "matrix-js-sdk/src/matrix" ;
11
- import { ComponentProps , ReactNode , forwardRef } from "react" ;
10
+ import { encodeUnpaddedBase64 , RoomMember } from "matrix-js-sdk/src/matrix" ;
11
+ import { ComponentProps , FC , ReactNode , forwardRef } from "react" ;
12
12
import { useTranslation } from "react-i18next" ;
13
13
import classNames from "classnames" ;
14
14
import { VideoTrack } from "@livekit/components-react" ;
@@ -18,7 +18,11 @@ import { ErrorIcon } from "@vector-im/compound-design-tokens/assets/web/icons";
18
18
import styles from "./MediaView.module.css" ;
19
19
import { Avatar } from "../Avatar" ;
20
20
import { RaisedHandIndicator } from "../reactions/RaisedHandIndicator" ;
21
- import { showHandRaisedTimer , useSetting } from "../settings/settings" ;
21
+ import {
22
+ showHandRaisedTimer ,
23
+ showMediaKeys as showMediaKeysSettings ,
24
+ useSetting ,
25
+ } from "../settings/settings" ;
22
26
23
27
interface Props extends ComponentProps < typeof animated . div > {
24
28
className ?: string ;
@@ -62,6 +66,7 @@ export const MediaView = forwardRef<HTMLDivElement, Props>(
62
66
) => {
63
67
const { t } = useTranslation ( ) ;
64
68
const [ handRaiseTimerVisible ] = useSetting ( showHandRaisedTimer ) ;
69
+ const [ showMediaKeys ] = useSetting ( showMediaKeysSettings ) ;
65
70
66
71
const avatarSize = Math . round ( Math . min ( targetWidth , targetHeight ) / 2 ) ;
67
72
@@ -100,12 +105,7 @@ export const MediaView = forwardRef<HTMLDivElement, Props>(
100
105
minature = { avatarSize < 96 }
101
106
showTimer = { handRaiseTimerVisible }
102
107
/>
103
- { /* {keys &&
104
- keys.map(({ index, key }) => (
105
- <Text as="span" size="sm">
106
- index:{index}, key:{key}
107
- </Text>
108
- ))} */ }
108
+ { keys && showMediaKeys && < MediaKeyList keys = { keys } /> }
109
109
< div className = { styles . nameTag } >
110
110
{ nameTagLeadingIcon }
111
111
< Text as = "span" size = "sm" weight = "medium" className = { styles . name } >
@@ -132,5 +132,45 @@ export const MediaView = forwardRef<HTMLDivElement, Props>(
132
132
) ;
133
133
} ,
134
134
) ;
135
+ interface MediaKeyListProps {
136
+ keys : {
137
+ index : number ;
138
+ key : Uint8Array ;
139
+ } [ ] ;
140
+ }
135
141
142
+ export const MediaKeyList : FC < MediaKeyListProps > = ( { keys } ) => {
143
+ return (
144
+ < div
145
+ style = { {
146
+ display : "flex" ,
147
+ flexDirection : "column" ,
148
+ height : "70%" ,
149
+ overflow : "scroll" ,
150
+ color : "white" ,
151
+ } }
152
+ >
153
+ { keys . map ( ( { index, key } ) => (
154
+ < div
155
+ style = { {
156
+ display : "flex" ,
157
+ flexDirection : "column" ,
158
+ backgroundColor : "#000000c0" ,
159
+ margin : "3px" ,
160
+ padding : "5px" ,
161
+ borderRadius : "5px" ,
162
+ } }
163
+ key = { index }
164
+ >
165
+ < Text as = "span" size = "sm" >
166
+ index:{ index }
167
+ </ Text >
168
+ < Text as = "span" size = "xs" >
169
+ key:{ key ? encodeUnpaddedBase64 ( key ) : "unavailable" }
170
+ </ Text >
171
+ </ div >
172
+ ) ) }
173
+ </ div >
174
+ ) ;
175
+ } ;
136
176
MediaView . displayName = "MediaView" ;
0 commit comments