-
-
Talking...
-
00:01:24
-
+ {activeSpeakerUserId ? (
+
+
+ {!activeSpeakerIsLocalUser && (
+
+ )}
+ {activeSpeakerIsLocalUser
+ ? "Talking..."
+ : `${activeSpeakerDisplayName} is talking...`}
+
+
+
+ ) : (
+
+ )}
-
Press and hold spacebar to talk
+
+ {showTalkOverError
+ ? "You can't talk at the same time"
+ : pttButtonHeld
+ ? "Release spacebar key to stop"
+ : talkOverEnabled &&
+ activeSpeakerUserId &&
+ !activeSpeakerIsLocalUser
+ ? `Press and hold spacebar to talk over ${activeSpeakerDisplayName}`
+ : "Press and hold spacebar to talk"}
+
{userMediaFeeds.map((callFeed) => (
))}
+ {isAdmin && (
+
+ )}
diff --git a/src/room/PTTCallView.module.css b/src/room/PTTCallView.module.css
index 56c41964..0da2ed22 100644
--- a/src/room/PTTCallView.module.css
+++ b/src/room/PTTCallView.module.css
@@ -38,6 +38,11 @@
flex-direction: column;
align-items: center;
margin-bottom: 20px;
+ height: 88px;
+}
+
+.speakerIcon {
+ margin-right: 8px;
}
.pttButtonContainer {
diff --git a/src/room/Timer.jsx b/src/room/Timer.jsx
new file mode 100644
index 00000000..bed43834
--- /dev/null
+++ b/src/room/Timer.jsx
@@ -0,0 +1,37 @@
+import React, { useEffect, useState } from "react";
+
+function leftPad(value) {
+ return value < 10 ? "0" + value : value;
+}
+
+function formatTime(msElapsed) {
+ const secondsElapsed = msElapsed / 1000;
+ const hours = Math.floor(secondsElapsed / 3600);
+ const minutes = Math.floor(secondsElapsed / 60) - hours * 60;
+ const seconds = Math.floor(secondsElapsed - hours * 3600 - minutes * 60);
+ return `${leftPad(hours)}:${leftPad(minutes)}:${leftPad(seconds)}`;
+}
+
+export function Timer({ value }) {
+ const [timestamp, setTimestamp] = useState();
+
+ useEffect(() => {
+ const startTimeMs = performance.now();
+
+ let animationFrame;
+
+ function onUpdate(curTimeMs) {
+ const msElapsed = curTimeMs - startTimeMs;
+ setTimestamp(formatTime(msElapsed));
+ animationFrame = requestAnimationFrame(onUpdate);
+ }
+
+ onUpdate(startTimeMs);
+
+ return () => {
+ cancelAnimationFrame(animationFrame);
+ };
+ }, [value]);
+
+ return