Merge pull request #2 from Hyathi/change-ui
Browse files
streaming-react-app/src/RoomConfig.tsx
CHANGED
|
@@ -1,22 +1,23 @@
|
|
| 1 |
-
import Stack from
|
| 2 |
-
import TextField from
|
| 3 |
-
import {isValidRoomID, isValidPartialRoomID} from
|
| 4 |
-
import {useCallback, useEffect, useState} from
|
| 5 |
-
import Button from
|
| 6 |
-
import {useSocket} from
|
| 7 |
-
import FormGroup from
|
| 8 |
-
import FormControlLabel from
|
| 9 |
-
import Checkbox from
|
| 10 |
-
import {RoomState} from
|
| 11 |
-
import setURLParam from
|
| 12 |
-
import {getURLParams} from
|
| 13 |
import {
|
| 14 |
JoinRoomConfig,
|
| 15 |
Roles,
|
| 16 |
ServerState,
|
| 17 |
StreamingStatus,
|
| 18 |
-
} from
|
| 19 |
-
import Alert from
|
|
|
|
| 20 |
|
| 21 |
function capitalize(str: string): string {
|
| 22 |
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
@@ -35,22 +36,22 @@ export default function RoomConfig({
|
|
| 35 |
onJoinRoomOrUpdateRoles,
|
| 36 |
streamingStatus,
|
| 37 |
}: Props) {
|
| 38 |
-
const {socket, clientID} = useSocket();
|
| 39 |
|
| 40 |
const urlParams = getURLParams();
|
| 41 |
const roomIDParam = urlParams.roomID;
|
| 42 |
const autoJoinRoom = urlParams.autoJoin;
|
| 43 |
|
| 44 |
const [roomID, setRoomID] = useState<string>(
|
| 45 |
-
(roomIDParam ??
|
| 46 |
);
|
| 47 |
const [roomIDError, setRoomIDError] = useState<boolean>(false);
|
| 48 |
-
const [roles, setRoles] = useState<{speaker: boolean; listener: boolean}>({
|
| 49 |
speaker: false,
|
| 50 |
listener: false,
|
| 51 |
});
|
| 52 |
const [lockServer, setLockServer] = useState<boolean>(false);
|
| 53 |
-
const [lockServerName, setLockServerName] = useState<string>(
|
| 54 |
|
| 55 |
const [joinInProgress, setJoinInProgress] = useState<boolean>(false);
|
| 56 |
const [didAttemptAutoJoin, setDidAttemptAutoJoin] = useState<boolean>(false);
|
|
@@ -66,39 +67,39 @@ export default function RoomConfig({
|
|
| 66 |
const onJoinRoom = useCallback(
|
| 67 |
(createNewRoom: boolean) => {
|
| 68 |
if (socket == null) {
|
| 69 |
-
console.error(
|
| 70 |
return;
|
| 71 |
}
|
| 72 |
console.debug(`Attempting to join roomID ${roomID}...`);
|
| 73 |
|
| 74 |
const lockServerValidated: string | null =
|
| 75 |
-
lockServer && roles[
|
| 76 |
|
| 77 |
setJoinInProgress(true);
|
| 78 |
|
| 79 |
const configObject: JoinRoomConfig = {
|
| 80 |
roles: (Object.keys(roles) as Array<Roles>).filter(
|
| 81 |
-
(role) => roles[role] === true
|
| 82 |
),
|
| 83 |
lockServerName: lockServerValidated,
|
| 84 |
};
|
| 85 |
|
| 86 |
socket.emit(
|
| 87 |
-
|
| 88 |
clientID,
|
| 89 |
createNewRoom ? null : roomID,
|
| 90 |
configObject,
|
| 91 |
(result) => {
|
| 92 |
-
console.log(
|
| 93 |
if (createNewRoom) {
|
| 94 |
setRoomID(result.roomID);
|
| 95 |
}
|
| 96 |
if (onJoinRoomOrUpdateRoles != null) {
|
| 97 |
onJoinRoomOrUpdateRoles();
|
| 98 |
}
|
| 99 |
-
setURLParam(
|
| 100 |
setJoinInProgress(false);
|
| 101 |
-
}
|
| 102 |
);
|
| 103 |
},
|
| 104 |
[
|
|
@@ -109,7 +110,7 @@ export default function RoomConfig({
|
|
| 109 |
roles,
|
| 110 |
roomID,
|
| 111 |
socket,
|
| 112 |
-
]
|
| 113 |
);
|
| 114 |
|
| 115 |
useEffect(() => {
|
|
@@ -126,11 +127,11 @@ export default function RoomConfig({
|
|
| 126 |
joinInProgress === false &&
|
| 127 |
roomIDFromServer == null
|
| 128 |
) {
|
| 129 |
-
console.debug(
|
| 130 |
|
| 131 |
onJoinRoom(false);
|
| 132 |
} else {
|
| 133 |
-
console.debug(
|
| 134 |
isValidAllInputs,
|
| 135 |
joinInProgress,
|
| 136 |
roomIDFromServer,
|
|
@@ -148,86 +149,129 @@ export default function RoomConfig({
|
|
| 148 |
]);
|
| 149 |
|
| 150 |
return (
|
| 151 |
-
<Stack direction="column" spacing="12px">
|
| 152 |
-
<Stack
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
variant="
|
| 176 |
-
disabled={
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
|
|
|
|
|
|
|
|
|
| 187 |
<div>
|
| 188 |
<Button
|
|
|
|
| 189 |
variant="contained"
|
| 190 |
disabled={
|
| 191 |
-
|
| 192 |
joinInProgress ||
|
| 193 |
-
streamingStatus !==
|
| 194 |
}
|
| 195 |
-
onClick={() => onJoinRoom(
|
| 196 |
-
|
|
|
|
| 197 |
</Button>
|
| 198 |
</div>
|
| 199 |
-
|
| 200 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
</Stack>
|
| 202 |
|
| 203 |
<FormGroup>
|
| 204 |
<Stack direction="row" justifyContent="space-between">
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
</Stack>
|
| 226 |
|
| 227 |
-
{urlParams.enableServerLock && roles[
|
| 228 |
<>
|
| 229 |
<FormControlLabel
|
| 230 |
-
disabled={streamingStatus !==
|
| 231 |
control={
|
| 232 |
<Checkbox
|
| 233 |
checked={lockServer}
|
|
@@ -243,10 +287,10 @@ export default function RoomConfig({
|
|
| 243 |
</FormGroup>
|
| 244 |
|
| 245 |
{urlParams.enableServerLock &&
|
| 246 |
-
roles[
|
| 247 |
lockServer && (
|
| 248 |
<TextField
|
| 249 |
-
disabled={streamingStatus !==
|
| 250 |
label="Enter Your Name + Expected Lock End Time"
|
| 251 |
variant="outlined"
|
| 252 |
value={lockServerName}
|
|
|
|
| 1 |
+
import Stack from "@mui/material/Stack";
|
| 2 |
+
import TextField from "@mui/material/TextField";
|
| 3 |
+
import { isValidRoomID, isValidPartialRoomID } from "./generateNewRoomID";
|
| 4 |
+
import { useCallback, useEffect, useState } from "react";
|
| 5 |
+
import Button from "@mui/material/Button";
|
| 6 |
+
import { useSocket } from "./useSocket";
|
| 7 |
+
import FormGroup from "@mui/material/FormGroup";
|
| 8 |
+
import FormControlLabel from "@mui/material/FormControlLabel";
|
| 9 |
+
import Checkbox from "@mui/material/Checkbox";
|
| 10 |
+
import { RoomState } from "./types/RoomState";
|
| 11 |
+
import setURLParam from "./setURLParam";
|
| 12 |
+
import { getURLParams } from "./URLParams";
|
| 13 |
import {
|
| 14 |
JoinRoomConfig,
|
| 15 |
Roles,
|
| 16 |
ServerState,
|
| 17 |
StreamingStatus,
|
| 18 |
+
} from "./types/StreamingTypes";
|
| 19 |
+
import Alert from "@mui/material/Alert";
|
| 20 |
+
import { Paper, Typography } from "@mui/material";
|
| 21 |
|
| 22 |
function capitalize(str: string): string {
|
| 23 |
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
|
|
| 36 |
onJoinRoomOrUpdateRoles,
|
| 37 |
streamingStatus,
|
| 38 |
}: Props) {
|
| 39 |
+
const { socket, clientID } = useSocket();
|
| 40 |
|
| 41 |
const urlParams = getURLParams();
|
| 42 |
const roomIDParam = urlParams.roomID;
|
| 43 |
const autoJoinRoom = urlParams.autoJoin;
|
| 44 |
|
| 45 |
const [roomID, setRoomID] = useState<string>(
|
| 46 |
+
(roomIDParam ?? "").toUpperCase()
|
| 47 |
);
|
| 48 |
const [roomIDError, setRoomIDError] = useState<boolean>(false);
|
| 49 |
+
const [roles, setRoles] = useState<{ speaker: boolean; listener: boolean }>({
|
| 50 |
speaker: false,
|
| 51 |
listener: false,
|
| 52 |
});
|
| 53 |
const [lockServer, setLockServer] = useState<boolean>(false);
|
| 54 |
+
const [lockServerName, setLockServerName] = useState<string>("");
|
| 55 |
|
| 56 |
const [joinInProgress, setJoinInProgress] = useState<boolean>(false);
|
| 57 |
const [didAttemptAutoJoin, setDidAttemptAutoJoin] = useState<boolean>(false);
|
|
|
|
| 67 |
const onJoinRoom = useCallback(
|
| 68 |
(createNewRoom: boolean) => {
|
| 69 |
if (socket == null) {
|
| 70 |
+
console.error("Socket is null, cannot join room");
|
| 71 |
return;
|
| 72 |
}
|
| 73 |
console.debug(`Attempting to join roomID ${roomID}...`);
|
| 74 |
|
| 75 |
const lockServerValidated: string | null =
|
| 76 |
+
lockServer && roles["speaker"] ? lockServerName : null;
|
| 77 |
|
| 78 |
setJoinInProgress(true);
|
| 79 |
|
| 80 |
const configObject: JoinRoomConfig = {
|
| 81 |
roles: (Object.keys(roles) as Array<Roles>).filter(
|
| 82 |
+
(role) => roles[role] === true
|
| 83 |
),
|
| 84 |
lockServerName: lockServerValidated,
|
| 85 |
};
|
| 86 |
|
| 87 |
socket.emit(
|
| 88 |
+
"join_room",
|
| 89 |
clientID,
|
| 90 |
createNewRoom ? null : roomID,
|
| 91 |
configObject,
|
| 92 |
(result) => {
|
| 93 |
+
console.log("join_room result:", result);
|
| 94 |
if (createNewRoom) {
|
| 95 |
setRoomID(result.roomID);
|
| 96 |
}
|
| 97 |
if (onJoinRoomOrUpdateRoles != null) {
|
| 98 |
onJoinRoomOrUpdateRoles();
|
| 99 |
}
|
| 100 |
+
setURLParam("roomID", result.roomID);
|
| 101 |
setJoinInProgress(false);
|
| 102 |
+
}
|
| 103 |
);
|
| 104 |
},
|
| 105 |
[
|
|
|
|
| 110 |
roles,
|
| 111 |
roomID,
|
| 112 |
socket,
|
| 113 |
+
]
|
| 114 |
);
|
| 115 |
|
| 116 |
useEffect(() => {
|
|
|
|
| 127 |
joinInProgress === false &&
|
| 128 |
roomIDFromServer == null
|
| 129 |
) {
|
| 130 |
+
console.debug("Attempting to auto-join room...");
|
| 131 |
|
| 132 |
onJoinRoom(false);
|
| 133 |
} else {
|
| 134 |
+
console.debug("Unable to auto-join room", {
|
| 135 |
isValidAllInputs,
|
| 136 |
joinInProgress,
|
| 137 |
roomIDFromServer,
|
|
|
|
| 149 |
]);
|
| 150 |
|
| 151 |
return (
|
| 152 |
+
<Stack direction="column" spacing="12px" sx={{ width: "80%" }}>
|
| 153 |
+
<Stack spacing={2}>
|
| 154 |
+
<Paper
|
| 155 |
+
elevation={3}
|
| 156 |
+
style={{
|
| 157 |
+
padding: "1em",
|
| 158 |
+
borderRadius: "15px",
|
| 159 |
+
border: "1px solid #ccc",
|
| 160 |
+
}}
|
| 161 |
+
>
|
| 162 |
+
<Stack
|
| 163 |
+
direction="column"
|
| 164 |
+
spacing={1}
|
| 165 |
+
sx={{ alignItems: "center", width: "100%" }}
|
| 166 |
+
>
|
| 167 |
+
<Typography fontWeight={600}>Join an Existing Room</Typography>
|
| 168 |
+
<Typography variant="body2">
|
| 169 |
+
Join an existing room by entering the room code provided by the
|
| 170 |
+
host.
|
| 171 |
+
</Typography>
|
| 172 |
+
<TextField
|
| 173 |
+
size="small"
|
| 174 |
+
label="Room Code"
|
| 175 |
+
placeholder="Enter Room Code"
|
| 176 |
+
variant="outlined"
|
| 177 |
+
disabled={roomState?.room_id != null}
|
| 178 |
+
value={roomID}
|
| 179 |
+
error={roomIDError}
|
| 180 |
+
onChange={(e) => {
|
| 181 |
+
const id = e.target.value.toUpperCase();
|
| 182 |
+
if (isValidPartialRoomID(id)) {
|
| 183 |
+
setRoomIDError(false);
|
| 184 |
+
setRoomID(id);
|
| 185 |
+
} else {
|
| 186 |
+
setRoomIDError(true);
|
| 187 |
+
}
|
| 188 |
+
}}
|
| 189 |
+
sx={{ width: "100%" }}
|
| 190 |
+
/>
|
| 191 |
<div>
|
| 192 |
<Button
|
| 193 |
+
sx={{borderRadius: "20px"}}
|
| 194 |
variant="contained"
|
| 195 |
disabled={
|
| 196 |
+
isValidAllInputs === false ||
|
| 197 |
joinInProgress ||
|
| 198 |
+
streamingStatus !== "stopped"
|
| 199 |
}
|
| 200 |
+
onClick={() => onJoinRoom(false)}
|
| 201 |
+
>
|
| 202 |
+
{roomState?.room_id != null ? "Update Roles" : "Join Room"}
|
| 203 |
</Button>
|
| 204 |
</div>
|
| 205 |
+
</Stack>
|
| 206 |
+
</Paper>
|
| 207 |
+
|
| 208 |
+
<Paper
|
| 209 |
+
elevation={3}
|
| 210 |
+
style={{
|
| 211 |
+
padding: "1em",
|
| 212 |
+
borderRadius: "15px",
|
| 213 |
+
border: "1px solid #ccc",
|
| 214 |
+
}}
|
| 215 |
+
>
|
| 216 |
+
<Stack
|
| 217 |
+
direction="column"
|
| 218 |
+
spacing={1}
|
| 219 |
+
sx={{ alignItems: "center", width: "100%" }}
|
| 220 |
+
>
|
| 221 |
+
<Typography fontWeight={600}>Create a New Room</Typography>
|
| 222 |
+
<Typography variant="body2">
|
| 223 |
+
Start a new room and invite others to join you in collaborative
|
| 224 |
+
sessions or discussions.
|
| 225 |
+
</Typography>
|
| 226 |
+
|
| 227 |
+
{roomState?.room_id == null && (
|
| 228 |
+
<div>
|
| 229 |
+
<Button
|
| 230 |
+
sx={{borderRadius: "20px"}}
|
| 231 |
+
variant="contained"
|
| 232 |
+
disabled={
|
| 233 |
+
roomState?.room_id != null ||
|
| 234 |
+
joinInProgress ||
|
| 235 |
+
streamingStatus !== "stopped"
|
| 236 |
+
}
|
| 237 |
+
onClick={() => onJoinRoom(true)}
|
| 238 |
+
>
|
| 239 |
+
{"Create New Room"}
|
| 240 |
+
</Button>
|
| 241 |
+
</div>
|
| 242 |
+
)}
|
| 243 |
+
</Stack>
|
| 244 |
+
</Paper>
|
| 245 |
</Stack>
|
| 246 |
|
| 247 |
<FormGroup>
|
| 248 |
<Stack direction="row" justifyContent="space-between">
|
| 249 |
+
{Object.keys(roles).map((role) => {
|
| 250 |
+
return (
|
| 251 |
+
<FormControlLabel
|
| 252 |
+
disabled={streamingStatus !== "stopped"}
|
| 253 |
+
key={role}
|
| 254 |
+
control={
|
| 255 |
+
<Checkbox
|
| 256 |
+
checked={roles[role]}
|
| 257 |
+
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
|
| 258 |
+
setRoles((prevRoles) => ({
|
| 259 |
+
...prevRoles,
|
| 260 |
+
[role]: event.target.checked,
|
| 261 |
+
}));
|
| 262 |
+
}}
|
| 263 |
+
/>
|
| 264 |
+
}
|
| 265 |
+
label={capitalize(role)}
|
| 266 |
+
/>
|
| 267 |
+
);
|
| 268 |
+
})}
|
| 269 |
</Stack>
|
| 270 |
|
| 271 |
+
{urlParams.enableServerLock && roles["speaker"] === true && (
|
| 272 |
<>
|
| 273 |
<FormControlLabel
|
| 274 |
+
disabled={streamingStatus !== "stopped"}
|
| 275 |
control={
|
| 276 |
<Checkbox
|
| 277 |
checked={lockServer}
|
|
|
|
| 287 |
</FormGroup>
|
| 288 |
|
| 289 |
{urlParams.enableServerLock &&
|
| 290 |
+
roles["speaker"] === true &&
|
| 291 |
lockServer && (
|
| 292 |
<TextField
|
| 293 |
+
disabled={streamingStatus !== "stopped"}
|
| 294 |
label="Enter Your Name + Expected Lock End Time"
|
| 295 |
variant="outlined"
|
| 296 |
value={lockServerName}
|
streaming-react-app/src/StreamingInterface.css
CHANGED
|
@@ -3,6 +3,8 @@
|
|
| 3 |
flex-direction: column;
|
| 4 |
justify-content: center;
|
| 5 |
align-items: center;
|
|
|
|
|
|
|
| 6 |
}
|
| 7 |
|
| 8 |
.main-container-sra {
|
|
@@ -11,8 +13,8 @@
|
|
| 11 |
flex-direction: column;
|
| 12 |
justify-content: flex-start;
|
| 13 |
text-align: left;
|
| 14 |
-
|
| 15 |
-
|
| 16 |
border-radius: 8px;
|
| 17 |
box-shadow: 0px 24px 30px rgba(0, 0, 0, 0.3);
|
| 18 |
border: 1px solid rgba(0, 0, 0, 0.05);
|
|
@@ -21,7 +23,7 @@
|
|
| 21 |
|
| 22 |
.top-section-sra {
|
| 23 |
padding-top: 24px;
|
| 24 |
-
|
| 25 |
}
|
| 26 |
|
| 27 |
.horizontal-padding-sra {
|
|
@@ -34,12 +36,12 @@
|
|
| 34 |
flex-direction: column;
|
| 35 |
gap:10px;
|
| 36 |
align-items: center;
|
| 37 |
-
|
| 38 |
}
|
| 39 |
|
| 40 |
.header-icon-sra {
|
| 41 |
display: block;
|
| 42 |
-
|
| 43 |
}
|
| 44 |
|
| 45 |
.translation-text-container-sra {
|
|
@@ -49,5 +51,5 @@
|
|
| 49 |
}
|
| 50 |
|
| 51 |
.text-chunk-sra {
|
| 52 |
-
|
| 53 |
}
|
|
|
|
| 3 |
flex-direction: column;
|
| 4 |
justify-content: center;
|
| 5 |
align-items: center;
|
| 6 |
+
width: 100%;
|
| 7 |
+
min-height: 100vh;
|
| 8 |
}
|
| 9 |
|
| 10 |
.main-container-sra {
|
|
|
|
| 13 |
flex-direction: column;
|
| 14 |
justify-content: flex-start;
|
| 15 |
text-align: left;
|
| 16 |
+
padding: 16px;
|
| 17 |
+
padding-bottom: 36px;
|
| 18 |
border-radius: 8px;
|
| 19 |
box-shadow: 0px 24px 30px rgba(0, 0, 0, 0.3);
|
| 20 |
border: 1px solid rgba(0, 0, 0, 0.05);
|
|
|
|
| 23 |
|
| 24 |
.top-section-sra {
|
| 25 |
padding-top: 24px;
|
| 26 |
+
padding-bottom: 24px;
|
| 27 |
}
|
| 28 |
|
| 29 |
.horizontal-padding-sra {
|
|
|
|
| 36 |
flex-direction: column;
|
| 37 |
gap:10px;
|
| 38 |
align-items: center;
|
| 39 |
+
padding-bottom: 20px;
|
| 40 |
}
|
| 41 |
|
| 42 |
.header-icon-sra {
|
| 43 |
display: block;
|
| 44 |
+
padding-right: 12px;
|
| 45 |
}
|
| 46 |
|
| 47 |
.translation-text-container-sra {
|
|
|
|
| 51 |
}
|
| 52 |
|
| 53 |
.text-chunk-sra {
|
| 54 |
+
padding-bottom: 12px;
|
| 55 |
}
|
streaming-react-app/src/StreamingInterface.tsx
CHANGED
|
@@ -98,8 +98,8 @@ async function requestDisplayMediaAudioStream(
|
|
| 98 |
}
|
| 99 |
|
| 100 |
const buttonLabelMap: {[key in StreamingStatus]: string} = {
|
| 101 |
-
stopped: 'Start
|
| 102 |
-
running: 'Stop
|
| 103 |
starting: 'Starting...',
|
| 104 |
};
|
| 105 |
|
|
@@ -734,13 +734,14 @@ export default function StreamingInterface() {
|
|
| 734 |
|
| 735 |
return (
|
| 736 |
<div className="app-wrapper-sra">
|
| 737 |
-
<
|
| 738 |
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
| 739 |
// @ts-ignore Not sure why it's complaining about complexity here
|
| 740 |
-
|
|
|
|
| 741 |
<div className="main-container-sra">
|
| 742 |
<Stack direction={{ xs: 'column', md: 'row' }} spacing={6} className="top-section-sra horizontal-padding-sra">
|
| 743 |
-
|
| 744 |
<div className="header-container-sra">
|
| 745 |
<img
|
| 746 |
src={"./logo.png"}
|
|
@@ -750,13 +751,13 @@ export default function StreamingInterface() {
|
|
| 750 |
/>
|
| 751 |
|
| 752 |
<div>
|
| 753 |
-
<Typography variant="h1" fontSize={
|
| 754 |
Hotdub Real Time Translation
|
| 755 |
</Typography>
|
| 756 |
</div>
|
| 757 |
</div>
|
| 758 |
|
| 759 |
-
<Box>
|
| 760 |
<RoomConfig
|
| 761 |
roomState={roomState}
|
| 762 |
serverState={serverState}
|
|
@@ -781,54 +782,13 @@ export default function StreamingInterface() {
|
|
| 781 |
{volumeSliderNode}
|
| 782 |
</Box>
|
| 783 |
)}
|
| 784 |
-
</Box>
|
| 785 |
</Stack>
|
| 786 |
|
| 787 |
<Stack spacing="22px" direction="column" sx={{flex:1}}>
|
| 788 |
{!isSpeaker && (
|
| 789 |
<>
|
| 790 |
-
|
| 791 |
-
<FormLabel id="output-modes-radio-group-label">
|
| 792 |
-
Model
|
| 793 |
-
</FormLabel>
|
| 794 |
-
<FormControl
|
| 795 |
-
disabled={
|
| 796 |
-
streamFixedConfigOptionsDisabled ||
|
| 797 |
-
agentsCapabilities.length === 0
|
| 798 |
-
}
|
| 799 |
-
fullWidth
|
| 800 |
-
sx={{minWidth: '14em'}}>
|
| 801 |
-
<InputLabel id="model-selector-input-label">
|
| 802 |
-
Model
|
| 803 |
-
</InputLabel>
|
| 804 |
-
<Select
|
| 805 |
-
labelId="model-selector-input-label"
|
| 806 |
-
label="Model"
|
| 807 |
-
onChange={(e: SelectChangeEvent) => {
|
| 808 |
-
const newAgent =
|
| 809 |
-
agentsCapabilities.find(
|
| 810 |
-
(agent) => e.target.value === agent.name,
|
| 811 |
-
) ?? null;
|
| 812 |
-
if (newAgent == null) {
|
| 813 |
-
console.error(
|
| 814 |
-
'Unable to find agent with name',
|
| 815 |
-
e.target.value,
|
| 816 |
-
);
|
| 817 |
-
}
|
| 818 |
-
setAgentAndUpdateParams(newAgent);
|
| 819 |
-
}}
|
| 820 |
-
value={model ?? ''}>
|
| 821 |
-
{agentsCapabilities.map((agent) => (
|
| 822 |
-
<MenuItem value={agent.name} key={agent.name}>
|
| 823 |
-
Hotdub Real Time Translation
|
| 824 |
-
</MenuItem>
|
| 825 |
-
))}
|
| 826 |
-
</Select>
|
| 827 |
-
</FormControl>
|
| 828 |
-
|
| 829 |
-
</Stack>
|
| 830 |
-
|
| 831 |
-
<Stack spacing={0.5}>
|
| 832 |
<FormLabel id="output-modes-radio-group-label">
|
| 833 |
Output
|
| 834 |
</FormLabel>
|
|
@@ -836,7 +796,7 @@ export default function StreamingInterface() {
|
|
| 836 |
<Box sx={{paddingTop: 2, paddingBottom: 1}}>
|
| 837 |
<FormControl fullWidth sx={{minWidth: '14em'}}>
|
| 838 |
<InputLabel id="target-selector-input-label">
|
| 839 |
-
|
| 840 |
</InputLabel>
|
| 841 |
<Select
|
| 842 |
labelId="target-selector-input-label"
|
|
@@ -934,14 +894,56 @@ export default function StreamingInterface() {
|
|
| 934 |
</Grid>
|
| 935 |
</Stack>
|
| 936 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 937 |
<Stack
|
| 938 |
direction="row"
|
| 939 |
-
spacing={2}
|
| 940 |
-
justifyContent="space-between">
|
| 941 |
-
<Box
|
| 942 |
<FormControl disabled={streamFixedConfigOptionsDisabled}>
|
| 943 |
<FormLabel id="input-source-radio-group-label">
|
| 944 |
-
|
| 945 |
</FormLabel>
|
| 946 |
<RadioGroup
|
| 947 |
aria-labelledby="input-source-radio-group-label"
|
|
@@ -964,7 +966,7 @@ export default function StreamingInterface() {
|
|
| 964 |
</FormControl>
|
| 965 |
</Box>
|
| 966 |
|
| 967 |
-
<Box
|
| 968 |
<FormControl disabled={streamFixedConfigOptionsDisabled}>
|
| 969 |
<FormLabel>Options</FormLabel>
|
| 970 |
<FormControlLabel
|
|
@@ -982,7 +984,7 @@ export default function StreamingInterface() {
|
|
| 982 |
}
|
| 983 |
/>
|
| 984 |
}
|
| 985 |
-
label="Noise
|
| 986 |
/>
|
| 987 |
<FormControlLabel
|
| 988 |
control={
|
|
@@ -999,7 +1001,7 @@ export default function StreamingInterface() {
|
|
| 999 |
}
|
| 1000 |
/>
|
| 1001 |
}
|
| 1002 |
-
label="Echo
|
| 1003 |
/>
|
| 1004 |
<FormControlLabel
|
| 1005 |
control={
|
|
@@ -1010,7 +1012,7 @@ export default function StreamingInterface() {
|
|
| 1010 |
) => setServerDebugFlag(event.target.checked)}
|
| 1011 |
/>
|
| 1012 |
}
|
| 1013 |
-
label="
|
| 1014 |
/>
|
| 1015 |
</FormControl>
|
| 1016 |
</Box>
|
|
@@ -1038,9 +1040,10 @@ export default function StreamingInterface() {
|
|
| 1038 |
</div>
|
| 1039 |
)}
|
| 1040 |
|
| 1041 |
-
<Stack direction="row" spacing={
|
| 1042 |
{streamingStatus === 'stopped' ? (
|
| 1043 |
<Button
|
|
|
|
| 1044 |
variant="contained"
|
| 1045 |
onClick={startStreaming}
|
| 1046 |
disabled={
|
|
@@ -1185,7 +1188,7 @@ export default function StreamingInterface() {
|
|
| 1185 |
</Stack>
|
| 1186 |
</div> */}
|
| 1187 |
</div>
|
| 1188 |
-
</
|
| 1189 |
</div>
|
| 1190 |
);
|
| 1191 |
}
|
|
|
|
| 98 |
}
|
| 99 |
|
| 100 |
const buttonLabelMap: {[key in StreamingStatus]: string} = {
|
| 101 |
+
stopped: 'Start broadcasting',
|
| 102 |
+
running: 'Stop broadcasting',
|
| 103 |
starting: 'Starting...',
|
| 104 |
};
|
| 105 |
|
|
|
|
| 734 |
|
| 735 |
return (
|
| 736 |
<div className="app-wrapper-sra">
|
| 737 |
+
<div
|
| 738 |
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
| 739 |
// @ts-ignore Not sure why it's complaining about complexity here
|
| 740 |
+
style={{width:"100%"}}
|
| 741 |
+
>
|
| 742 |
<div className="main-container-sra">
|
| 743 |
<Stack direction={{ xs: 'column', md: 'row' }} spacing={6} className="top-section-sra horizontal-padding-sra">
|
| 744 |
+
<Stack alignItems="center" sx={{ flex: 1, borderRight: { md: 1 } }}>
|
| 745 |
<div className="header-container-sra">
|
| 746 |
<img
|
| 747 |
src={"./logo.png"}
|
|
|
|
| 751 |
/>
|
| 752 |
|
| 753 |
<div>
|
| 754 |
+
<Typography variant="h1" fontSize={20} >
|
| 755 |
Hotdub Real Time Translation
|
| 756 |
</Typography>
|
| 757 |
</div>
|
| 758 |
</div>
|
| 759 |
|
| 760 |
+
{/* <Box> */}
|
| 761 |
<RoomConfig
|
| 762 |
roomState={roomState}
|
| 763 |
serverState={serverState}
|
|
|
|
| 782 |
{volumeSliderNode}
|
| 783 |
</Box>
|
| 784 |
)}
|
| 785 |
+
{/* </Box> */}
|
| 786 |
</Stack>
|
| 787 |
|
| 788 |
<Stack spacing="22px" direction="column" sx={{flex:1}}>
|
| 789 |
{!isSpeaker && (
|
| 790 |
<>
|
| 791 |
+
<Stack spacing={0.5}>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 792 |
<FormLabel id="output-modes-radio-group-label">
|
| 793 |
Output
|
| 794 |
</FormLabel>
|
|
|
|
| 796 |
<Box sx={{paddingTop: 2, paddingBottom: 1}}>
|
| 797 |
<FormControl fullWidth sx={{minWidth: '14em'}}>
|
| 798 |
<InputLabel id="target-selector-input-label">
|
| 799 |
+
Language
|
| 800 |
</InputLabel>
|
| 801 |
<Select
|
| 802 |
labelId="target-selector-input-label"
|
|
|
|
| 894 |
</Grid>
|
| 895 |
</Stack>
|
| 896 |
|
| 897 |
+
<Stack spacing="12px" direction="column">
|
| 898 |
+
<FormLabel id="output-modes-radio-group-label">
|
| 899 |
+
Model
|
| 900 |
+
</FormLabel>
|
| 901 |
+
<FormControl
|
| 902 |
+
disabled={
|
| 903 |
+
streamFixedConfigOptionsDisabled ||
|
| 904 |
+
agentsCapabilities.length === 0
|
| 905 |
+
}
|
| 906 |
+
fullWidth
|
| 907 |
+
sx={{minWidth: '14em'}}>
|
| 908 |
+
<InputLabel id="model-selector-input-label">
|
| 909 |
+
Model
|
| 910 |
+
</InputLabel>
|
| 911 |
+
<Select
|
| 912 |
+
labelId="model-selector-input-label"
|
| 913 |
+
label="Model"
|
| 914 |
+
onChange={(e: SelectChangeEvent) => {
|
| 915 |
+
const newAgent =
|
| 916 |
+
agentsCapabilities.find(
|
| 917 |
+
(agent) => e.target.value === agent.name,
|
| 918 |
+
) ?? null;
|
| 919 |
+
if (newAgent == null) {
|
| 920 |
+
console.error(
|
| 921 |
+
'Unable to find agent with name',
|
| 922 |
+
e.target.value,
|
| 923 |
+
);
|
| 924 |
+
}
|
| 925 |
+
setAgentAndUpdateParams(newAgent);
|
| 926 |
+
}}
|
| 927 |
+
value={model ?? ''}>
|
| 928 |
+
{agentsCapabilities.map((agent) => (
|
| 929 |
+
<MenuItem value={agent.name} key={agent.name}>
|
| 930 |
+
Hotdub Real Time Translation
|
| 931 |
+
</MenuItem>
|
| 932 |
+
))}
|
| 933 |
+
</Select>
|
| 934 |
+
</FormControl>
|
| 935 |
+
|
| 936 |
+
</Stack>
|
| 937 |
+
|
| 938 |
+
|
| 939 |
<Stack
|
| 940 |
direction="row"
|
| 941 |
+
// spacing={2}
|
| 942 |
+
justifyContent="space-between" >
|
| 943 |
+
<Box >
|
| 944 |
<FormControl disabled={streamFixedConfigOptionsDisabled}>
|
| 945 |
<FormLabel id="input-source-radio-group-label">
|
| 946 |
+
Audio Input
|
| 947 |
</FormLabel>
|
| 948 |
<RadioGroup
|
| 949 |
aria-labelledby="input-source-radio-group-label"
|
|
|
|
| 966 |
</FormControl>
|
| 967 |
</Box>
|
| 968 |
|
| 969 |
+
<Box >
|
| 970 |
<FormControl disabled={streamFixedConfigOptionsDisabled}>
|
| 971 |
<FormLabel>Options</FormLabel>
|
| 972 |
<FormControlLabel
|
|
|
|
| 984 |
}
|
| 985 |
/>
|
| 986 |
}
|
| 987 |
+
label="Noise Reduction"
|
| 988 |
/>
|
| 989 |
<FormControlLabel
|
| 990 |
control={
|
|
|
|
| 1001 |
}
|
| 1002 |
/>
|
| 1003 |
}
|
| 1004 |
+
label="Echo Reduction"
|
| 1005 |
/>
|
| 1006 |
<FormControlLabel
|
| 1007 |
control={
|
|
|
|
| 1012 |
) => setServerDebugFlag(event.target.checked)}
|
| 1013 |
/>
|
| 1014 |
}
|
| 1015 |
+
label="Debug Mode"
|
| 1016 |
/>
|
| 1017 |
</FormControl>
|
| 1018 |
</Box>
|
|
|
|
| 1040 |
</div>
|
| 1041 |
)}
|
| 1042 |
|
| 1043 |
+
<Stack direction="row" spacing={6} justifyContent="center">
|
| 1044 |
{streamingStatus === 'stopped' ? (
|
| 1045 |
<Button
|
| 1046 |
+
sx={{borderRadius: "20px"}}
|
| 1047 |
variant="contained"
|
| 1048 |
onClick={startStreaming}
|
| 1049 |
disabled={
|
|
|
|
| 1188 |
</Stack>
|
| 1189 |
</div> */}
|
| 1190 |
</div>
|
| 1191 |
+
</div>
|
| 1192 |
</div>
|
| 1193 |
);
|
| 1194 |
}
|
streaming-react-app/src/theme.ts
CHANGED
|
@@ -21,7 +21,6 @@ const themeObject = {
|
|
| 21 |
// text: {primary: '#1C2A33'},
|
| 22 |
// },
|
| 23 |
palette: {
|
| 24 |
-
background: {default: '#000033'},
|
| 25 |
primary: {
|
| 26 |
main: '#1976d2',
|
| 27 |
},
|
|
|
|
| 21 |
// text: {primary: '#1C2A33'},
|
| 22 |
// },
|
| 23 |
palette: {
|
|
|
|
| 24 |
primary: {
|
| 25 |
main: '#1976d2',
|
| 26 |
},
|
streaming-react-app/src/types/StreamingTypes.ts
CHANGED
|
@@ -54,7 +54,7 @@ export const SUPPORTED_INPUT_SOURCES: Array<{
|
|
| 54 |
label: string;
|
| 55 |
}> = [
|
| 56 |
{value: 'userMedia', label: 'Microphone'},
|
| 57 |
-
{value: 'displayMedia', label: 'Browser Tab
|
| 58 |
];
|
| 59 |
|
| 60 |
export type StartStreamEventConfig = {
|
|
|
|
| 54 |
label: string;
|
| 55 |
}> = [
|
| 56 |
{value: 'userMedia', label: 'Microphone'},
|
| 57 |
+
{value: 'displayMedia', label: 'Browser Tab'},
|
| 58 |
];
|
| 59 |
|
| 60 |
export type StartStreamEventConfig = {
|