Skip to content

Commit

Permalink
Merge pull request Sunbird-ALL#151 from Sunbird-ALL/all-1.2-tn-dev
Browse files Browse the repository at this point in the history
All 1.2 tn dev
  • Loading branch information
gouravmore authored Aug 28, 2024
2 parents 6058d87 + 0cdb94b commit 3ffbca6
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 218 deletions.
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

0 comments on commit 3ffbca6

Please sign in to comment.