Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All 1.2 tn dev #151

Merged
merged 9 commits into from
Aug 28, 2024
26 changes: 13 additions & 13 deletions src/components/Mechanism/WordsOrImage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const WordsOrImage = ({
loading,
setOpenMessageDialog,
isNextButtonCalled,
setIsNextButtonCalled
setIsNextButtonCalled,
}) => {
const audioRef = createRef(null);
const [duration, setDuration] = useState(0);
Expand Down Expand Up @@ -90,7 +90,7 @@ const WordsOrImage = ({
livesData,
gameOverData,
loading,
setIsNextButtonCalled
setIsNextButtonCalled,
}}
>
<CardContent
Expand Down Expand Up @@ -210,7 +210,7 @@ const WordsOrImage = ({
mb: 4,
color: "#333F61",
textAlign: "center",
fontSize: "40px",
fontSize: "clamp(1.6rem, 2.5vw, 3.8rem)",
// lineHeight: "normal",
fontWeight: 700,
fontFamily: "Quicksand",
Expand All @@ -222,18 +222,18 @@ const WordsOrImage = ({
)}
{matchedChar && (
<Box
display={"flex"}
mb={4}
sx={{
width: "100%",
justifyContent: "center",
flexWrap: "wrap",
}}
>
display={"flex"}
mb={4}
sx={{
width: "100%",
justifyContent: "center",
flexWrap: "wrap",
}}
>
{highlightWords(words, matchedChar)}
</Box>
)}
</Box>
</Box>
)}
<Box sx={{ display: "flex", justifyContent: "center" }}>
<VoiceAnalyser
Expand All @@ -257,7 +257,7 @@ const WordsOrImage = ({
setLivesData,
setOpenMessageDialog,
isNextButtonCalled,
setIsNextButtonCalled
setIsNextButtonCalled,
}}
/>
</Box>
Expand Down
50 changes: 26 additions & 24 deletions src/utils/AudioCompare.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const AudioRecorder = (props) => {
recorderType: RecordRTC.StereoAudioRecorder, // Use StereoAudioRecorder for better compatibility
numberOfAudioChannels: 1, // Match the same number of audio channels
desiredSampRate: 16000, // Adjust the sample rate if necessary to match
disableLogs: true,
});

recorderRef.current.startRecording();
Expand Down Expand Up @@ -116,33 +117,34 @@ const AudioRecorder = (props) => {
}}
className="game-action-button"
>
{(!props.dontShowListen || props.recordedAudio) && (
<>
{!props.pauseAudio ? (
<div
onClick={() => {
props.playAudio(true);
}}
>
<Box sx={{ cursor: "pointer" }}>
<ListenButton />
{props?.originalText &&
(!props.dontShowListen || props.recordedAudio) && (
<>
{!props.pauseAudio ? (
<div
onClick={() => {
props.playAudio(true);
}}
>
<Box sx={{ cursor: "pointer" }}>
<ListenButton />
</Box>
</div>
) : (
<Box
sx={{ cursor: "pointer" }}
onClick={() => {
props.playAudio(false);
}}
>
<StopButton />
</Box>
</div>
) : (
<Box
sx={{ cursor: "pointer" }}
onClick={() => {
props.playAudio(false);
}}
>
<StopButton />
</Box>
)}
</>
)}
)}
</>
)}

<div>
{!props.showOnlyListen && (
{props?.originalText && !props.showOnlyListen && (
<Box
marginLeft={
!props.dontShowListen || props.recordedAudio
Expand Down
Loading
Loading