Commit ba96757f authored by AdithyaKahawanugoda's avatar AdithyaKahawanugoda

pc activitiy videos croped

parent 6c82a518
...@@ -61,15 +61,11 @@ const PictureConcept = ({ nextActivity }) => { ...@@ -61,15 +61,11 @@ const PictureConcept = ({ nextActivity }) => {
useEffect(() => { useEffect(() => {
if (effectRan.current === false) { if (effectRan.current === false) {
RecordingHandler(`PC.wav`, activityIndex, "pc"); RecordingHandler(`PC.wav`, activityIndex, "pc");
return () => { return () => {
console.log("unmounted"); console.log("unmounted");
effectRan.current = true; effectRan.current = true;
}; };
} }
// console.log(activityIndex);
// RecordingHandler(`PC.wav`, activityIndex, "pc");
}, [activityIndex]); }, [activityIndex]);
useEffect(() => { useEffect(() => {
......
...@@ -22,17 +22,16 @@ export const RecordingHandler = async ( ...@@ -22,17 +22,16 @@ export const RecordingHandler = async (
recorder.record(); recorder.record();
const sleep = (m) => new Promise((r) => setTimeout(r, m)); const sleep = (m) => new Promise((r) => setTimeout(r, m));
sleep(15000); //await await sleep(15000);
//await await recorder.stop(function () {
recorder.stop(function () {
console.log("Stopped Activity Index: ", questionIndex); console.log("Stopped Activity Index: ", questionIndex);
let blob = recorder.blob; let blob = recorder.blob;
stream.getTracks().forEach(function (track) {
track.stop();
});
processRecording(blob, fileName, questionIndex, activityName); processRecording(blob, fileName, questionIndex, activityName);
}); });
stream.getTracks().forEach(function (track) {
track.stop();
});
}; };
const processRecording = (blob, fileName, questionIndex, activityName) => { const processRecording = (blob, fileName, questionIndex, activityName) => {
...@@ -59,13 +58,13 @@ const uploadRecording = async (file, fileName, questionIndex, activityName) => { ...@@ -59,13 +58,13 @@ const uploadRecording = async (file, fileName, questionIndex, activityName) => {
}; };
if (activityName === "pc") { if (activityName === "pc") {
// await API.post(`predictPictureConcept`, data, config) await API.post(`predictPictureConcept`, data, config)
// .then((res) => { .then((res) => {
// console.log(res.data); console.log(res.data);
// }) })
// .catch((err) => { .catch((err) => {
// console.log(err, "ERROR"); console.log(err, "ERROR");
// }); });
} }
if (activityName === "ar") { if (activityName === "ar") {
// await API.post(`predictArithmetic`, data, config) // await API.post(`predictArithmetic`, data, config)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment