【问题标题】:Play streamed audio in browser (Asp.net)在浏览器中播放流式音频 (Asp.net)
【发布时间】:2010-08-25 15:16:41
【问题描述】:

我正在努力让它工作很长一段时间。我有一个 asp.net 页面,我试图在其中播放 wav 文件。页面加载事件中的代码如下:

Response.Clear()  
Response.ContentType = "audio/wav"  
Response.AppendHeader("Content-Disposition", "inline;filename=" + "temp.wav")  
Dim filePath As String = Server.MapPath("/temp.wav")  
If Not String.IsNullOrEmpty(filePath) Then  
    'Here I am converting the file to a byte array,as eventually I'll be creating the wav files on the fly  
    Dim fileBytes As Byte() = GetFileBytes(filePath)  
    Response.BinaryWrite(fileBytes)  
    Response.Flush()  
End If

我遇到的问题是每次运行此页面时,Windows 媒体播放器都会打开。我希望使用浏览器中的一些内置插件播放音频。比如,当你点击一个语音图标时,声音是如何在不打开任何播放器的情况下弹出的。

如果我在 ashx 处理程序中有相同的内容,会更好吗?

我无法使用 embed 标记,因为我不会在服务器上拥有物理文件,它将使用响应流动态生成。

感谢任何帮助!

【问题讨论】:

    标签: asp.net audio wav response.write


    【解决方案1】:

    您必须使用 Flash 或 ActiveX,或类似的东西。

    【讨论】:

    • 你知道我是否可以在某个地方找到一个很好的例子,因为我没有任何使用 Flash / ActiveX 的经验
    猜你喜欢
    • 2017-07-12
    • 1970-01-01
    • 1970-01-01
    • 2011-03-05
    • 1970-01-01
    • 1970-01-01
    • 2012-06-09
    • 1970-01-01
    • 2015-03-25
    相关资源
    最近更新 更多