Check connection before starting broadcast (#9857)
This commit is contained in:
parent
fbfa174ad0
commit
be972bc913
6 changed files with 88 additions and 14 deletions
|
@ -650,6 +650,8 @@
|
|||
"You are already recording a voice broadcast. Please end your current voice broadcast to start a new one.": "You are already recording a voice broadcast. Please end your current voice broadcast to start a new one.",
|
||||
"You don't have the required permissions to start a voice broadcast in this room. Contact a room administrator to upgrade your permissions.": "You don't have the required permissions to start a voice broadcast in this room. Contact a room administrator to upgrade your permissions.",
|
||||
"Someone else is already recording a voice broadcast. Wait for their voice broadcast to end to start a new one.": "Someone else is already recording a voice broadcast. Wait for their voice broadcast to end to start a new one.",
|
||||
"Connection error": "Connection error",
|
||||
"Unfortunately we're unable to start a recording right now. Please try again later.": "Unfortunately we're unable to start a recording right now. Please try again later.",
|
||||
"Can’t start a call": "Can’t start a call",
|
||||
"You can’t start a call as you are currently recording a live broadcast. Please end your live broadcast in order to start a call.": "You can’t start a call as you are currently recording a live broadcast. Please end your live broadcast in order to start a call.",
|
||||
"You ended a <a>voice broadcast</a>": "You ended a <a>voice broadcast</a>",
|
||||
|
|
|
@ -16,6 +16,7 @@ limitations under the License.
|
|||
|
||||
import React from "react";
|
||||
import { MatrixClient, Room } from "matrix-js-sdk/src/matrix";
|
||||
import { SyncState } from "matrix-js-sdk/src/sync";
|
||||
|
||||
import { hasRoomLiveVoiceBroadcast, VoiceBroadcastInfoEventType, VoiceBroadcastRecordingsStore } from "..";
|
||||
import InfoDialog from "../../components/views/dialogs/InfoDialog";
|
||||
|
@ -67,6 +68,14 @@ const showOthersAlreadyRecordingDialog = () => {
|
|||
});
|
||||
};
|
||||
|
||||
const showNoConnectionDialog = (): void => {
|
||||
Modal.createDialog(InfoDialog, {
|
||||
title: _t("Connection error"),
|
||||
description: <p>{_t("Unfortunately we're unable to start a recording right now. Please try again later.")}</p>,
|
||||
hasCloseButton: true,
|
||||
});
|
||||
};
|
||||
|
||||
export const checkVoiceBroadcastPreConditions = async (
|
||||
room: Room,
|
||||
client: MatrixClient,
|
||||
|
@ -86,6 +95,11 @@ export const checkVoiceBroadcastPreConditions = async (
|
|||
return false;
|
||||
}
|
||||
|
||||
if (client.getSyncState() === SyncState.Error) {
|
||||
showNoConnectionDialog();
|
||||
return false;
|
||||
}
|
||||
|
||||
const { hasBroadcast, startedByUser } = await hasRoomLiveVoiceBroadcast(client, room, currentUserId);
|
||||
|
||||
if (hasBroadcast && startedByUser) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue