user click start button and record video start but when countdown complete i call handleStop function for stop record
but onCapture not call fo send video to my service
this is my code =>
import Webcam from "react-webcam";
import {useRef, useState} from "react";
import React from "react"
import {blobToBase64} from "../tools/helpers";
import {useStreamManager} from "../tools/contexts/StreamManager";
import {BsCameraVideoOff} from "react-icons/bs";
import Spinner from "./Spinner";
import BottomButtonWrapper from "./BottomButtonWrapper";
import Button from "./Button";
import {BiChevronRight} from "react-icons/bi";
import {FaQuestionCircle} from "react-icons/fa";
import Countdown from "react-countdown";
user click start button and record video start but when countdown complete i call handleStop function for stop record but onCapture not call fo send video to my service
this is my code =>
import Webcam from "react-webcam"; import {useRef, useState} from "react"; import React from "react" import {blobToBase64} from "../tools/helpers"; import {useStreamManager} from "../tools/contexts/StreamManager"; import {BsCameraVideoOff} from "react-icons/bs"; import Spinner from "./Spinner"; import BottomButtonWrapper from "./BottomButtonWrapper"; import Button from "./Button"; import {BiChevronRight} from "react-icons/bi"; import {FaQuestionCircle} from "react-icons/fa"; import Countdown from "react-countdown";
const VideoCamera1 = ({max, title, handleShowGuid, hasBack, onBack, onCapture, webcamRef, faceMode = 'environment'}) => { const {startStream} = useStreamManager(); const [start, setStart] = useState(false); const clockRef = useRef(); const mediaRecorderRef = React.useRef(null); const [recordedChunks, setRecordedChunks] = React.useState([]); const [isLoading, setLoading] = useState(true); const [cameraError, setCameraError] = useState(null); const handleDownload = React.useCallback(() => { if (recordedChunks.length) { const blob = new Blob(recordedChunks, { type: faceMode ? "video/mp4" : "video/webm" }); blobToBase64(blob).then(res => { onCapture(res);
const handleStop=()=>{ setStart(false) clockRef.current.stop(); handleStopCaptureClick(); }
} export default VideoCamera1