简体   繁体   中英

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.

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.

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM