@@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
55Please see LICENSE in the repository root for full details.
66*/
77
8- import { type ChangeEvent , type FC , useCallback } from "react" ;
8+ import { type ChangeEvent , type FC , useCallback , useMemo } from "react" ;
99import { useTranslation } from "react-i18next" ;
1010
1111import { FieldRow , InputField } from "../input/Input" ;
@@ -17,12 +17,14 @@ import {
1717 showConnectionStats as showConnectionStatsSetting ,
1818} from "./settings" ;
1919import type { MatrixClient } from "matrix-js-sdk/src/client" ;
20-
20+ import type { Room as LivekitRoom } from "livekit-client" ;
21+ import styles from "./DeveloperSettingsTab.module.css" ;
2122interface Props {
2223 client : MatrixClient ;
24+ livekitRoom ?: LivekitRoom ;
2325}
2426
25- export const DeveloperSettingsTab : FC < Props > = ( { client } ) => {
27+ export const DeveloperSettingsTab : FC < Props > = ( { client, livekitRoom } ) => {
2628 const { t } = useTranslation ( ) ;
2729 const [ duplicateTiles , setDuplicateTiles ] = useSetting ( duplicateTilesSetting ) ;
2830 const [ debugTileLayout , setDebugTileLayout ] = useSetting (
@@ -36,6 +38,16 @@ export const DeveloperSettingsTab: FC<Props> = ({ client }) => {
3638 showConnectionStatsSetting ,
3739 ) ;
3840
41+ const sfuUrl = useMemo ( ( ) : URL | null => {
42+ if ( livekitRoom ?. engine . client . ws ?. url ) {
43+ // strip the URL params
44+ const url = new URL ( livekitRoom . engine . client . ws . url ) ;
45+ url . search = "" ;
46+ return url ;
47+ }
48+ return null ;
49+ } , [ livekitRoom ] ) ;
50+
3951 return (
4052 < >
4153 < p >
@@ -122,6 +134,22 @@ export const DeveloperSettingsTab: FC<Props> = ({ client }) => {
122134 ) }
123135 />
124136 </ FieldRow >
137+ { livekitRoom ? (
138+ < >
139+ < p >
140+ { t ( "developer_mode.livekit_sfu" , {
141+ url : sfuUrl ?. href || "unknown" ,
142+ } ) }
143+ </ p >
144+ < p > { t ( "developer_mode.livekit_server_info" ) } </ p >
145+ < pre className = { styles . pre } >
146+ { livekitRoom . serverInfo
147+ ? JSON . stringify ( livekitRoom . serverInfo , null , 2 )
148+ : "undefined" }
149+ { livekitRoom . metadata }
150+ </ pre >
151+ </ >
152+ ) : null }
125153 </ >
126154 ) ;
127155} ;
0 commit comments