Seeking through a streamed MP3 file with HTML5 <audio> tag
Posted
by Kyle Slattery
on Stack Overflow
See other posts from Stack Overflow
or by Kyle Slattery
Published on 2010-05-09T19:45:14Z
Indexed on
2010/05/10
1:58 UTC
Read the original article
Hit count: 330
Hopefully someone can help me out with this.
I'm playing around with a node.js server that streams audio to a client, and I want to create an HTML5 player. Right now, I'm streaming the code from node using chunked encoding, and if you go directly to the URL, it works great.
What I'd like to do is embed this using the HTML5 <audio>
tag, like so:
<audio src="http://server/stream?file=123">
where /stream
is the endpoint for the node server to stream the MP3. The HTML5 player loads fine in Safari and Chrome, but it doesn't allow me to seek, and Safari even says it's a "Live Broadcast". In the headers of /stream
, I include the file size and file type, and the response gets ended properly.
Any thoughts on how I could get around this? I certainly could just send the whole file at once, but then the player would wait until the whole thing is downloaded--I'd rather stream it.
© Stack Overflow or respective owner