diff --git a/src/Livestream.ts b/src/Livestream.ts index d4bed63dbd..cd8cdea179 100644 --- a/src/Livestream.ts +++ b/src/Livestream.ts @@ -39,14 +39,14 @@ async function createLiveStream(roomId: string) { }), }); - const respBody = response.json(); + const respBody = await response.json(); return respBody['stream_id']; } export async function startJitsiAudioLivestream(widgetMessaging: ClientWidgetApi, roomId: string) { const streamId = await createLiveStream(roomId); - widgetMessaging.transport.send(ElementWidgetActions.StartLiveStream, { - rtmpStreamKey: 'audioStream:' + streamId, + await widgetMessaging.transport.send(ElementWidgetActions.StartLiveStream, { + rtmpStreamKey: 'rtmp://audiostream.dummy/' + streamId, }); } diff --git a/src/components/views/context_menus/WidgetContextMenu.tsx b/src/components/views/context_menus/WidgetContextMenu.tsx index e7d1c02c66..0503df038a 100644 --- a/src/components/views/context_menus/WidgetContextMenu.tsx +++ b/src/components/views/context_menus/WidgetContextMenu.tsx @@ -28,6 +28,7 @@ import dis from "../../../dispatcher/dispatcher"; import SettingsStore from "../../../settings/SettingsStore"; import Modal from "../../../Modal"; import QuestionDialog from "../dialogs/QuestionDialog"; +import ErrorDialog from "../dialogs/ErrorDialog"; import {WidgetType} from "../../../widgets/WidgetType"; import MatrixClientContext from "../../../contexts/MatrixClientContext"; import { Container, WidgetLayoutStore } from "../../../stores/widgets/WidgetLayoutStore"; @@ -57,8 +58,18 @@ const WidgetContextMenu: React.FC = ({ let streamAudioStreamButton; if (getConfigLivestreamUrl() && (app.type === "m.jitsi" || app.type === "jitsi")) { - const onStreamAudioClick = () => { - startJitsiAudioLivestream(widgetMessaging, roomId); + const onStreamAudioClick = async () => { + try { + await startJitsiAudioLivestream(widgetMessaging, roomId); + } catch (err) { + console.log("Failed to start livestream", err); + // XXX: won't i18n well, but looks like widget api only support 'message'? + const message = err.message || _t("Unable to start audio streaming."); + Modal.createTrackedDialog('WidgetContext Menu', 'Livestream failed', ErrorDialog, { + title: _t('Failed to start livestream'), + description: message, + }); + } onFinished(); }; streamAudioStreamButton =