T
T
Tenebrius2015-07-24 22:21:15
JavaScript
Tenebrius, 2015-07-24 22:21:15

How can I get data about an audio file using JS?

Suppose there is such a construction:
<audio src="site/audio/music1.mp3"></audio>
Is it possible to get the file name and its duration using JavaScript?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Pavlenko, 2015-07-24
@Tenebrius

After all, it googles once or twice, it was worth entering, the very first two links:
stackoverflow.com/questions/6332384/read-id3-tags-... - a few tips
https://github.com/aadsm/JavaScript-ID3-Reader - library for reading ID3 tags
And actually for bitrate:
stackoverflow.com/questions/21634091/is-it-possibl...

0
0X12eb, 2015-07-24
@0X12eb

<audio id="my-audio" src="site/audio/music1.mp3"></audio>

<script>
  var myAudio = document.getElmentById("my-audio");
  alert(myAudio.duration); // Длительность
</script>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question