outstore
outstore

Reputation: 175

Get ID3 tag from MP3 Streaming

I encounter difficulties in recovering informations (ID3 tag) from an MP3 stream. I want this informations for display the albumArt and the title of the current song on the homepage of the radiomed's website.

Update


With PHP , I worked with ID3 library for PHP, but this library was not up to date since 2004 and with Javascript , I worked with TagLib, MusicMetadata and id3js . The results were errors messages (js) and string (0) with a var_dump($getID3) // this return the object obtain with the catched info from the stream .

The result should be, title and artist of the current on air song.

I tried with php & js but I failed.

Upvotes: 0

Views: 2505

Answers (2)

r4ven
r4ven

Reputation: 303

You could try to use PECL extension if you want to fetch id3 directly from mp3

pecl install id3-0.2

And than use a id3_get_tag function:

<?php
   $tag = id3_get_tag( "path/to/example.mp3" );
   print_r($tag);
?>

But instead doing this, i would search documentation of your streaming software, probably there is some api to fetch stream data (json, xml, plain text)

Upvotes: 0

user4466350
user4466350

Reputation:

This example can help you https://gist.github.com/fracasula/5781710

But it won t read the stream conitnuously, it will just fetch first buffer and try it. It may or may not returns the current track name, it depends.

It needs to be improved, i guess, to read stream in continue and detect each buffer for track data. Thus you could show it wherever needed.

Upvotes: 1

Related Questions