test1.mp3 and test2.mp3 have the same bitrate and sample rate, and I'm trying to merge them in an HTTP response. The resulting file is test.mp3.
test.mp3 plays fine in WMP12 and VLC. In WMP11, I hear only the audio which came from test1.mp3. At the moment you expect to hear the beginning of test2.mp3's audio, the player stops playing. WMP11 reports no errors... it just stops playing.
What needs to change such that test.mp3 will play correctly in WMP11?
protected void Page_Load(object sender, EventArgs e) {
Response.Clear();
Response.ContentType = "audio/mpeg";
Response.AddHeader("Content-Disposition", "attachment; filename=test.mp3");
var bytes1 = System.IO.File.ReadAllBytes(@"C:\test1.mp3");
WriteBytesToResponse(bytes1);
var bytes2 = System.IO.File.ReadAllBytes(@"C:\test2.mp3");
WriteBytesToResponse(bytes2);
Response.End();
}
private void WriteBytesToResponse(byte[] sourceBytes) {
using (var sourceStream = new MemoryStream(sourceBytes, false)) {
sourceStream.WriteTo(Response.OutputStream);
}
}