Echo the length of an audio file

Is there a way to echo the lenght of an audio file (mp3) in the format HH:MM:SS?

<?php echo $item->audio()->first()->size() ?>

This for example echoes only a string of the filesize

1 Like

I just dumped a mp3 file object (<?php dump($file) ?>) and it doesn’t seem like anything regarding duration is saved in the meta data. You will probably need to use something like getid3 for this.

1 Like