How to properly provide data for ?
I am serving binary data for HTML5 audio thorough .aspx page. The file can
be played but there is a problem with SeekBar and replaying in Safari
(iPad), Chrome, Firefox.
Client side:
<audio controls="controls" autoplay="autoplay">
<source src="play.aspx?filename=sound.mp3" type="audio/mp3" />
</audio>
Server part (code taken from PRB: Response.WriteFile cannot download a
large file and only key parts are here):
Response.AddHeader("Content-Disposition", "filename=\"" + JustFileName +
"\"");
Response.AddHeader("Content-Length", dataLength);
Response.ContentType = "audio/mp3"
...
Response.OutputStream.Write(Buffer, 0, length);
...
Response.End();
So Content-Disposition, Content-Length and Content-Type headers are
supplied. The code is used for serving other file types (images, .xls,
...) without any problem.
Problems
Safari (iPad): When the play button is pressed the sound is played but
there is "Streaming.." instead of Seek Bar and playing seem to last
forever and sound cannot be replayed.
Firefox(windows): Seek Bar is displayed but shows increasing time until
end and behaves correctly when replayed.
Chrome(windows): Seek bar correct but cannot be replayed.
IE10: OK
I found the similar questions on but without an answer. From observing
other page with fiddler it seems that header Accept-Ranges: bytes and
Content-Range: bytes 0-8100780/8100781 can help. However provide necessary
features seems to be too difficult as just an attempt so I did not try it.
Note I am looking for solution for other problem in How to play .m4a with
HTML5 audio in IE(9+) and Safari (Pad)?
Tuesday, August 20, 2013
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment