Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show title and author of song being streamed #424

Open
MineRobber9000 opened this issue Nov 10, 2019 · 4 comments
Open

Show title and author of song being streamed #424

MineRobber9000 opened this issue Nov 10, 2019 · 4 comments

Comments

@MineRobber9000
Copy link

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.

@ghost
Copy link

ghost commented Nov 17, 2019

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.

@MineRobber9000
Copy link
Author

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

@ghost
Copy link

ghost commented Nov 19, 2019

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.

@thenickchapman
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants