Skip to content
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

How to find useful url of the recorded video to store the video in database #108

Open
Arif-Islam opened this issue Aug 25, 2022 · 1 comment

Comments

@Arif-Islam
Copy link

Arif-Islam commented Aug 25, 2022

I sent the recorded video in mongodb database using the mediaBlobUrl. But mediaBlobUrl of the video isn't useful to store in database as the video can't be retireved from the database. Recorded video url is generated like this -

blob:http://localhost:3000/001a9d09-da0a-40a6-8118-501d7a894

As a result, the video can't be retreived from the database. Can anyone help how can I store the recorded video in database and retreive it? Please...

@GabGuerra
Copy link

GabGuerra commented Sep 2, 2022

You can store the audio`s base64.

Here`s how you can generate it.

const readFileData = () => {
        if (!mediaBlobUrl) return;

        const reader = new FileReader();

        fetch(mediaBlobUrl)
            .then((res) => res.blob())
            .then((blob) => {
                reader.readAsDataURL(blob);
                reader.onloadend = () => {
                    console.log('Base64: ', reader.result?.toString())
                };
            });
    };

With the base64 you can create an audio tag so you can display and listen to an audio on your front-end.

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

2 participants