Better error handling for streams
Also use older youtubeStreamKey as it appears our jitsi doesn't support the newer one.
This commit is contained in:
parent
63944b9f6d
commit
0f1b7a001e
3 changed files with 18 additions and 5 deletions
|
@ -39,14 +39,14 @@ async function createLiveStream(roomId: string) {
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const respBody = response.json();
|
const respBody = await response.json();
|
||||||
return respBody['stream_id'];
|
return respBody['stream_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function startJitsiAudioLivestream(widgetMessaging: ClientWidgetApi, roomId: string) {
|
export async function startJitsiAudioLivestream(widgetMessaging: ClientWidgetApi, roomId: string) {
|
||||||
const streamId = await createLiveStream(roomId);
|
const streamId = await createLiveStream(roomId);
|
||||||
|
|
||||||
widgetMessaging.transport.send(ElementWidgetActions.StartLiveStream, {
|
await widgetMessaging.transport.send(ElementWidgetActions.StartLiveStream, {
|
||||||
rtmpStreamKey: 'audioStream:' + streamId,
|
rtmpStreamKey: 'rtmp://audiostream.dummy/' + streamId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import dis from "../../../dispatcher/dispatcher";
|
||||||
import SettingsStore from "../../../settings/SettingsStore";
|
import SettingsStore from "../../../settings/SettingsStore";
|
||||||
import Modal from "../../../Modal";
|
import Modal from "../../../Modal";
|
||||||
import QuestionDialog from "../dialogs/QuestionDialog";
|
import QuestionDialog from "../dialogs/QuestionDialog";
|
||||||
|
import ErrorDialog from "../dialogs/ErrorDialog";
|
||||||
import {WidgetType} from "../../../widgets/WidgetType";
|
import {WidgetType} from "../../../widgets/WidgetType";
|
||||||
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||||
import { Container, WidgetLayoutStore } from "../../../stores/widgets/WidgetLayoutStore";
|
import { Container, WidgetLayoutStore } from "../../../stores/widgets/WidgetLayoutStore";
|
||||||
|
@ -57,8 +58,18 @@ const WidgetContextMenu: React.FC<IProps> = ({
|
||||||
|
|
||||||
let streamAudioStreamButton;
|
let streamAudioStreamButton;
|
||||||
if (getConfigLivestreamUrl() && (app.type === "m.jitsi" || app.type === "jitsi")) {
|
if (getConfigLivestreamUrl() && (app.type === "m.jitsi" || app.type === "jitsi")) {
|
||||||
const onStreamAudioClick = () => {
|
const onStreamAudioClick = async () => {
|
||||||
startJitsiAudioLivestream(widgetMessaging, roomId);
|
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();
|
onFinished();
|
||||||
};
|
};
|
||||||
streamAudioStreamButton = <IconizedContextMenuOption
|
streamAudioStreamButton = <IconizedContextMenuOption
|
||||||
|
|
|
@ -2357,6 +2357,8 @@
|
||||||
"Set status": "Set status",
|
"Set status": "Set status",
|
||||||
"Set a new status...": "Set a new status...",
|
"Set a new status...": "Set a new status...",
|
||||||
"View Community": "View Community",
|
"View Community": "View Community",
|
||||||
|
"Failed to start livestream": "Failed to start livestream",
|
||||||
|
"Unable to start audio streaming.": "Unable to start audio streaming.",
|
||||||
"Start audio stream": "Start audio stream",
|
"Start audio stream": "Start audio stream",
|
||||||
"Take a picture": "Take a picture",
|
"Take a picture": "Take a picture",
|
||||||
"Delete Widget": "Delete Widget",
|
"Delete Widget": "Delete Widget",
|
||||||
|
|
Loading…
Reference in a new issue