Skip to content

Post Build this functionality not working #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
persistentWeb opened this issue Jun 7, 2021 · 2 comments
Open

Post Build this functionality not working #8

persistentWeb opened this issue Jun 7, 2021 · 2 comments

Comments

@persistentWeb
Copy link

audio-react-recorder is working well on localhost. but when I built the project and hosted it to server (non-secure url). mic is neither accessible. when saw the site permissions, it shows microphone blocked and I am not able to enable it.

Please help.

@ghost
Copy link

ghost commented Jun 8, 2021

If you are currently working with the latest react then you'll be able to request permissions from the client using React.useEffect() :

// ask permissions to access the microphone first before proceeding further
    const [isBlocked, setIsBlocked] = React.useState(false);

    React.useEffect(() => {
        navigator.getUserMedia(
            {audio: true},
            () => {
                console.log('Access granted.');
                setIsBlocked(false);
            },
            () => {
                console.log('Access denied.');
                setIsBlocked(true);
            });
    }, [isBlocked]);

Hope it helps.

you'll be able to change permission to the mic if you click an icon next to the addressbar. Once it's done, browser will ask you to reload the page.

@ghost
Copy link

ghost commented Jun 12, 2021

Code above works on Microsoft Edge (Chromium based), however on Firefox it produces errors such as "unknown .getUserMedia". There are some rumors about firefox releasing "Permissions API" which by now is marked as experimental feature and still not available to the public yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant