jPlayer icon indicating copy to clipboard operation
jPlayer copied to clipboard

Show title and author of song being streamed

Open MineRobber9000 opened this issue 6 years ago • 4 comments

It would be really helpful if jPlayer could show the title and author of the song playing (as received in the id3 tags). For example, one of my friends has some music streams on their site. Because they use jPlayer, I can't see the title of the song that's playing. Therefore, even if I really like a song, I don't know the name of the song to look it up later.

MineRobber9000 avatar Nov 10 '19 03:11 MineRobber9000

To the best of my knowledge, JP is only an A/V player and does not parse the stream for metadata such as ID3 tags. Plus, stream parsing is CPU-intensive and not the best task for a browser (esp. on mobile). I did find find 43081j/id3 that apparently opens a second connection and fetches only what it needs to extract the ID3 info, but it requires same origin and I was not successful testing on your friend’s streams.

But, your friend’s server seems to be either xiph/Icecast-Server or SHOUTcast. I used my own server-side stream parser (sector7g/icecast-monitor-ng) and got this output:

"2019-11-17 12:04:57.287","Information","IcyMonitorNg.IcyService started for 'http://107.170.20.195:8005'"
"2019-11-17 12:04:57.658","Information","Received response from 'http://107.170.20.195:8005'. 'icy-metaint': 8192"
"2019-11-17 12:07:02.266","Information","Song changed: Vibrants, (C) 1993-94 Brain Bug - Lollypop: Title"
"2019-11-17 12:13:24.593","Information","Song changed: Jesper Olsen (V) - AAAAARGGGHHH"

The ‘icy-metaint’: 8192 response header proves the server is SHOUTcast, Icecast, or ultimately based on “ICY” conventions. The simplest way to get such a server’s “now playing” data would be a periodic poll from the browser to either [stream url]/stats?sid=1 for SHOUTcast servers where “sid” equals stream ID, normally “1”, or [stream url]/status-json.xsl for Icecast servers. Example: http://cast.sector7g.com:8000/status-json.xsl => JSON where “title” may be easily extracted in the browser.

But, it does not seem either is enabled for your friend’s streams. However that doesn’t necessarily mean it can’t be enabled or that this technique won’t work with other sites.

ghost avatar Nov 17 '19 17:11 ghost

They use mpd's built in streamer, which does not give a status.

MineRobber9000 avatar Nov 18 '19 16:11 MineRobber9000

Since it's a stream, something on the server would likely be required to read/parse the raw bytes and find the metadata (vs an mp3 file's tags). I have some ideas for you/your friend. Feel free to hit me up on gjbdebug gmail or Gitter.

ghost avatar Nov 19 '19 03:11 ghost

I know this is a little old...but.

I finally decided to add this feature to jPlaylister (http://jplaylister.yaheard.us) because I use a scrobbler when listening on my phone that seems like it'd be able to scrobble my played songs to lastfm that way. I've been parsing out ID3 tags using a getid3() for a while and used that info (or filename, which is faster) to build a jPlayer Playlist based on a specified folder's contents. So updating the page title should be trivial.

All that said, I know this is a different beast as compared to pulling the data from a stream, but I thought I'd mention it here. I'm hoping to update the code tonight, but it might be a week or two before I finish if I run into trouble and could be a few before I update the public-facing code as I've still to transition to Git, sadly.

Take care!

thenickchapman avatar May 18 '20 02:05 thenickchapman