Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get and show meta informations (stations name, current song, bitrate, etc) when playing a radio stream with HTML5 audio?

How could I retrieve the current song title, radio stations name and other meta info from a radio stream played with Html5?

<script>

$(document).ready(function(){

AudCurs=new Audio();


$('#play').click(function(){
AudCurs.setAttribute('src','http://62.27.26.45:8000/klassikradio128/livestream.mp3');

AudCurs.play();

});
});


</script>

<button id='play' >Play</button>

thanks for you help

like image 564
ChrisGP Avatar asked Nov 22 '25 12:11

ChrisGP


1 Answers

According to the HTML5 standard and Mozilla, there are not many details which you can fetch [1, 2, 3].

You can get the sample rate:

var rate = AudCurs.playbackRate;

Probably your stream supports ID3 tags. If that's the case, you can fetch some additional infos: http://ericbidelman.tumblr.com/post/8343485440/reading-mp3-id3-tags-in-javascript

To fetch more details, I would recommend you to implement this on the server side and then fetch the results using AJAX and JQuery.

like image 166
SecStone Avatar answered Nov 24 '25 05:11

SecStone