feat: play sound effect on new text particle
This commit is contained in:
Binary file not shown.
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
declare module "*.wav" {
|
||||||
|
const src: string;
|
||||||
|
export default src;
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useEffect, useMemo, useRef } from "react";
|
import { useEffect, useMemo, useRef } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import beepSound from "../../../assets/sound.wav";
|
||||||
import {
|
import {
|
||||||
Radio,
|
Radio,
|
||||||
MessageSquare,
|
MessageSquare,
|
||||||
@@ -103,9 +104,15 @@ function StreamRow({
|
|||||||
if (latestChild.id === settledIdRef.current) return;
|
if (latestChild.id === settledIdRef.current) return;
|
||||||
settledIdRef.current = latestChild.id;
|
settledIdRef.current = latestChild.id;
|
||||||
|
|
||||||
if (latestChild.type !== "media") return;
|
|
||||||
if (latestChild.created_by_email === userEmail) return;
|
if (latestChild.created_by_email === userEmail) return;
|
||||||
|
|
||||||
|
if (latestChild.type === "text") {
|
||||||
|
new Audio(beepSound).play().catch(() => {});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (latestChild.type !== "media") return;
|
||||||
|
|
||||||
useAutoplayStore.getState().play(latestChild, particle.id);
|
useAutoplayStore.getState().play(latestChild, particle.id);
|
||||||
}, [latestChild?.id]); // eslint-disable-line react-hooks/exhaustive-deps
|
}, [latestChild?.id]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user