Pc browser acquires audio stream, how to transmit it to the background in real time

Code:
if (navigator.getUserMedia) {

        navigator.getUserMedia(
            // constraints
            {
                //video: true,
                audio: true
            },
            // successCallback
            function (localMediaStream) {
                var audio = document.querySelector("audio");
                console.log(localMediaStream,"");
                audio.src = window.URL.createObjectURL(localMediaStream);
                console.log(audio.src,"")
                // do whatever you want with the video
                audio.play();
            },
            // errorCallback
            function (err) {
                console.log("The following error occured: " + err);
            });
    } else {
        alert("getUserMedia not supported by your web browser or Operating system version");
    }
    
    
    localMediaStreampcbloburlaudio
    :localMediaStreammp3
    

you can submit blob to the backend in real time via ajax


Video works the same as audio. Here, take audio as an example.

in fact, this problem you need to negotiate with the backend, assuming that there is an interface to accept file streams in the background, then the code looks like this:

navigator.getUserMedia(
            // constraints
            {
                //video: true,
                audio: true
            },
            // successCallback
            function (localMediaStream) {
               fetch(url, {
                   method: 'POST',
                   body: localMediaStream
               })
            },
            // errorCallback
            function (err) {
                console.log("The following error occured: " + err);
            });
    } else {
        alert("getUserMedia not supported by your web browser or Operating system version");
    }

Brother, have you solved your problem? I have the same problem

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e45427-43a96.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e45427-43a96.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?