English 中文(简体)
将编织物档案简化到Ipad和<audio>。
原标题:Streaming wav file to Ipad and Firefox with <audio>

I´m trying to play wav files with the audio element. This works great when I reference the file directly BUT when I try to stream it via a c# FileStream it stops working. The code below work perfect for Chrome and Opera on PC but I am trying to get it to work on Ipad and Firefox. I am using .net framwork 2.0 I have to use wav.

<audio id="audio" src="www.acme.com/streamer.aspx?music=test.wav" controls preload="auto"></audio> Not working
<audio id="audio" src="test.wav" controls preload="auto"></audio> Working

上游职能如下:

string wavFileName = test.wav;
FileStream soundStream;
long FileSize;


soundStream = new FileStream(@"\netshare" + wavfileName, FileMode.Open, FileAccess.Read, FileShare.Read, 256);
FileSize = soundStream.Length;
byte[] Buffer = new byte[(int)FileSize];
int count = 0;
int offset = 0;
while ((count = soundStream.Read(Buffer, offset,
Buffer.Length)) > 0)
{
    Response.OutputStream.Write(Buffer, offset, count);
}
Response.Buffer = true;
Response.Clear();

Response.AddHeader("Content-Type", "audio/wave");
Response.AddHeader("Content-Disposition", "attachment;filename=" + wavfileName);
Response.ContentType = "audio/wave";
Response.BinaryWrite(Buffer);
if (soundStream != null)
{
    soundStream.Close();
}

Response.End();

(两次,这是我的第一个职位,希望不要违反任何规则)

问题回答

该法典似乎被罚款。 我认为,你们需要确保编织物的文字记录。 一些浏览器存在某些手工加工企业的问题。 我发现,仅仅因为浏览器(html5)支持编织物,并不意味着它实际上会发挥所有挖掘作用。

你们还可能想弄清反应。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签