Search code examples
javascriptpythonhtmlsoundmanager2

Passing ID3 info in stream and parsing in Front End


I have been loving SoundManager2 as a front end music player (with python backend) for our MP3 streaming player, but the player interface starts togglePausing (or something with a similar result) when the stream has id3 frames injected into it.

I want to use the ID3 frames (or some other method) to mark points in the stream so I can display details about each particular (currently playing) segment.

The stream plays flawlessly in the Chrome mp3 player.

So I'm looking for some insight into how to reconfigure SM2 to handle the mid-stream id3 tags. I understand that HTML5 does not support id3 and have seen some JavaScript libraries that retrieve id3v1 and id3v2 tags, but haven't yet found one that can work with a stream.

Is it even possible to include and retrieve id3 tags within a stream or are we barking up the wrong tree here?


Solution

  • According to the SM2 developer (thank you, Scott):

    HTML5 audio is a bit "dumb" when it comes to playback options as it's largely fire-and-forget - you don't really get access to any metadata events, nor the raw audio stream etc. There is a metadata event in HTML5, but I don't believe it fires more than once at initial load/request time, nor does it include ID3 information.

    There is the newer Web Audio API for super low-latency playback and bit-level stream access, but it has its share of bugs and inconsistent implementations (although it's getting better) and is not supported in any version of IE. (Perhaps it'll be in IE 12, TBD.)

    As undesirable as it is, I might consider polling the server every so often to get current stream metadata. If it's a live stream, you can have the server return the current artist/title as known. If static, you could have the client send the current time offset and determine which song etc. based on that.

    Flash 8/9 do provide some support of ID3 parsing, but it is often unreliable and comes with other limitations - notably that Flash does not do "streaming" well at all.