@@ -19,8 +19,6 @@ require("./index.scss");
1919
2020import * as qs from 'querystring' ;
2121import { Capability , WidgetApi } from "matrix-react-sdk/src/widgets/WidgetApi" ;
22- import SdkConfig from "matrix-react-sdk/src/SdkConfig" ;
23- import { loadConfig , preparePlatform } from "../initial-load" ;
2422
2523// Dev note: we use raw JS without many dependencies to reduce bundle size.
2624// We do not need all of React to render a Jitsi conference.
@@ -54,28 +52,26 @@ let widgetApi: WidgetApi;
5452 // Set this up as early as possible because Riot will be hitting it almost immediately.
5553 widgetApi = new WidgetApi ( qsParam ( 'parentUrl' ) , qsParam ( 'widgetId' ) , [
5654 Capability . AlwaysOnScreen ,
55+ Capability . GetRiotWebConfig ,
5756 ] ) ;
58-
59- widgetApi . waitReady ( ) . then ( async ( ) => {
60- // Start off by ensuring we're not stuck on screen
61- await widgetApi . setAlwaysOnScreen ( false ) ;
62- } ) ;
63-
64- // Bootstrap ourselves for loading the script and such
65- preparePlatform ( ) ;
66- await loadConfig ( ) ;
57+ widgetApi . expectingExplicitReady = true ;
6758
6859 // Populate the Jitsi params now
69- jitsiDomain = qsParam ( 'conferenceDomain' , true ) || SdkConfig . get ( ) [ 'jitsi' ] [ 'preferredDomain' ] ;
60+ jitsiDomain = qsParam ( 'conferenceDomain' ) ;
7061 conferenceId = qsParam ( 'conferenceId' ) ;
7162 displayName = qsParam ( 'displayName' , true ) ;
7263 avatarUrl = qsParam ( 'avatarUrl' , true ) ; // http not mxc
7364 userId = qsParam ( 'userId' ) ;
7465
66+ await widgetApi . waitReady ( ) ;
67+ await widgetApi . setAlwaysOnScreen ( false ) ; // start off as detachable from the screen
68+
69+ const riotConfig = await widgetApi . getRiotConfig ( ) ;
70+
7571 // Get the Jitsi Meet API loaded up as fast as possible, but ensure that the widget's postMessage
7672 // receiver (WidgetApi) is up and running first.
7773 const scriptTag = document . createElement ( "script" ) ;
78- scriptTag . src = SdkConfig . get ( ) [ 'jitsi' ] [ 'externalApiUrl' ] ;
74+ scriptTag . src = riotConfig [ 'jitsi' ] [ 'externalApiUrl' ] ;
7975 document . body . appendChild ( scriptTag ) ;
8076
8177 // TODO: register widgetApi listeners for PTT controls (https://github.com/vector-im/riot-web/issues/12795)
0 commit comments