Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove red icon after recording has stopped

I am using recording.js. The functionality is working fine but after I stop recording the red icon still appears in chrome's tab(near title). Please suggest what to do. Sorry if it is damn easy.. :P

This is my code:

window.URL = window.URL || window.webkitURL;
    navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;

    var recorder;
    var savedSrc = '';
    var audio = document.querySelector('audio');

var onFail = function(e)
    {
        console.log('Rejected!', e);
    };

    var onSuccess = function(s)
    {
        var context = new AudioContext();
        var mediaStreamSource = context.createMediaStreamSource(s);
        recorder = new Recorder(mediaStreamSource);
        recorder.record();
        $('#recordText').html('Recording...');
        // audio loopback
        // mediaStreamSource.connect(context.destination);
    };



    function startRecording()
    {
        if (navigator.getUserMedia)
        {
            navigator.getUserMedia(
            {
                video : false,
                audio : true,
                toString : function()
                {
                    return "audio";
                }
            }, onSuccess, onFail);
        }
        else
        {
            console.log('navigator.getUserMedia not present');
        }

    };

    function stopRecording()
    {
        $('#recordText').html('Record');
        recorder.stop();
        recorder.exportWAV(function(s)
        {

            audio.src = window.URL.createObjectURL(s);
        });
    }
like image 751
Hitesh Avatar asked Oct 31 '14 08:10

Hitesh


People also ask

How do I turn off media recorder?

This is because this recording icon is the one of getUserMedia streaming, not the one of MediaRecorder . When you stop the MediaRecorder, the stream is still active. To stop this gUM stream (or any other MediaStream), you'd call MediaStreamTrack. stop() .

How do I stop a recording in Javascript?

In your soundAllowed(stream) function, you can stop the recording by executing stream. getTracks()[0]. stop() assuming that you only have that media track active.

What is MediaRecorder?

The MediaRecorder API enables you to record audio and video from a web app. It's available now in Firefox and in Chrome for Android and desktop.

How do I Turn Off hidden screen recording on Android 11?

On the main page, choose "Status Bar," then "Auto Detect." After a second or two, the app will display a new page with every status bar icon available on your Android 11 device, including the hidden screen recording icon. Disable the toggle next to the "screen_record" option and you're all set!

How do I fix the red mark on my audio output?

When you restart your system, these issues will be cleared and, hopefully, the red mark will be gone. The troubleshooter is a built-in tool designed to find and resolve problems affecting your audio output. It primarily checks for conflicts that are preventing the audio service from running properly and promptly gets rid of them.

How do I fix the Red X mark on my screen?

On the Hardware and Sound page, click on Manage Audio Devices under Sound. Once the Sound dialog window appears, select your system’s main speakers as the default device and click on the OK button. The presence of the red X mark might be an indication that the Windows audio services aren’t functioning properly.

How do I Turn Off screen recording notifications?

From there, start a recording, then expand your notification shade and long-press the recording notification. Select the gear icon that appears, then choose "Screen Recorder" and set it to "Silent" on the next screen. Now, you'll still have the notification for stopping recording, but you won't see any icons in your status bar!


1 Answers

To remove red icon after using Recorder.js:

var audioStream;    
var onSuccess = function(s) {
    ...
    audioStream = s;
}

function stopRecording() {
   ...
   audioStream.getTracks()[0].stop();
}

getTracks() returns only one element since you use only audio in your config.

I hope it will help someone.

like image 72
akaravashkin Avatar answered Oct 01 '22 00:10

akaravashkin