Lorti / vue-dictaphone

🎙️ Vue.js dictaphone component to record audio from the user
MIT License
24 stars 8 forks source link

How to get duration from blob? #24

Closed annagat closed 3 years ago

annagat commented 3 years ago

Hello,

I'm a newbie. This is not really an issue but a question. I am not sure if this is the right place to ask but since I am using this library, I just thought somebody could help. How do I get the duration from blob?

handleRecording ({ blob, src }) { var audioSource = { src: src, blob: blob } this.records.push(audioSource)

var file = blob + '.mp3' console.log(file.duration) }

I want to make a list of the recorded audio and I want to display the duration of each audio/blob file.

Thanks in advance.

Lorti commented 3 years ago

I haven't tried, but you might have to create an actual HTMLAudioElement in the browser using your blob. You should then be able to access its duration property.

annagat commented 3 years ago

I haven't tried, but you might have to create an actual HTMLAudioElement in the browser using your blob. You should then be able to access its duration property.

You're right. I figured it out. Thanks for the response.