Guides

Sharing video ineria more features

How to add a 2 minute limit and only add the ability to add audio and save to mp3 without video?

marcin18481 Member
marcin18481
0
3
59
Haz Member
Haz
Moderator

Hi @marcin18481 and welcome to the forum.

What have you tried so far? Can you share some code so we can help you better. Could you explain in greater detail what you are trying to achieve, as I didn't quite understand. Are you looking to convert a video to MP3? What do you mean by 2 minute limit?

marcin18481 Member
marcin18481

I would like it to be possible to set a recording time limit after which the recording ends. Add the functionality of recording only sound and exporting it to mp3 format.

I don't have the code, I'm just starting to dig into the code.

alex Member
alex
Moderator

Here's a very rough guide to setting the time limit:

  1. After the user hits record, set a JavaScript timer (using setTimeout). Increment the callback by 1 second and display this to the user based on the timeout you need (if 2 minutes, store limit as 120000 and decrement from this).
  2. Use a library like dayjs to format the amount of time remaining.
  3. Inside the setTimeout, once you get down to 0 from the 120000 timeout, cancel the recording and continue to do everything you'd normally do on the manual press of a button

I hope this gives you a rough idea of how to implement this. Feel free to jump back in once you have some code or have tried something and I'd be happy to guide you :)