mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-08 20:09:19 +00:00
Add a sound for when a hand is raised.
This commit is contained in:
BIN
src/res/sounds/raise-hand.ogg
Normal file
BIN
src/res/sounds/raise-hand.ogg
Normal file
Binary file not shown.
@@ -87,6 +87,7 @@ import { makeSpotlightLandscapeLayout } from "../grid/SpotlightLandscapeLayout";
|
|||||||
import { makeSpotlightPortraitLayout } from "../grid/SpotlightPortraitLayout";
|
import { makeSpotlightPortraitLayout } from "../grid/SpotlightPortraitLayout";
|
||||||
import { useMatrixRTCSessionMemberships } from "../useMatrixRTCSessionMemberships";
|
import { useMatrixRTCSessionMemberships } from "../useMatrixRTCSessionMemberships";
|
||||||
import { useReactions } from "../useReactions";
|
import { useReactions } from "../useReactions";
|
||||||
|
import handSound from "../res/sounds/raise-hand.ogg?url";
|
||||||
|
|
||||||
const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {});
|
const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {});
|
||||||
|
|
||||||
@@ -314,6 +315,8 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
const [reactionId, setReactionId] = useState<string | null>(null);
|
const [reactionId, setReactionId] = useState<string | null>(null);
|
||||||
const userId = client.getUserId()!;
|
const userId = client.getUserId()!;
|
||||||
|
|
||||||
|
const handRaisePlayer = useRef<HTMLAudioElement>(null);
|
||||||
|
|
||||||
const isHandRaised = !!raisedHands[userId];
|
const isHandRaised = !!raisedHands[userId];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -369,6 +372,9 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
const content = event.getContent() as ReactionEventContent;
|
const content = event.getContent() as ReactionEventContent;
|
||||||
if (content?.["m.relates_to"].key === "🖐️") {
|
if (content?.["m.relates_to"].key === "🖐️") {
|
||||||
addRaisedHand(sender, new Date(event.localTimestamp));
|
addRaisedHand(sender, new Date(event.localTimestamp));
|
||||||
|
handRaisePlayer.current?.play().catch((ex) => {
|
||||||
|
logger.warn("Failed to play hand raise sound", ex);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.getType() === EventType.RoomRedaction && event.getSender()) {
|
if (event.getType() === EventType.RoomRedaction && event.getSender()) {
|
||||||
@@ -737,6 +743,7 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
))}
|
))}
|
||||||
<RoomAudioRenderer />
|
<RoomAudioRenderer />
|
||||||
{renderContent()}
|
{renderContent()}
|
||||||
|
<audio ref={handRaisePlayer} src={handSound} hidden />
|
||||||
{footer}
|
{footer}
|
||||||
{!noControls && <RageshakeRequestModal {...rageshakeRequestModalProps} />}
|
{!noControls && <RageshakeRequestModal {...rageshakeRequestModalProps} />}
|
||||||
<SettingsModal
|
<SettingsModal
|
||||||
|
|||||||
Reference in New Issue
Block a user