简体   繁体   English

HTML5音频元件在互联网信息服务服务器中不起作用

[英]HTML5 audio element do not work in the internet information service server

I have created an audio stream starting from OBS to a RTMP followed by streaming from the RTMP Server via VLC to an HTTP stream.我创建了一个音频 stream,从 OBS 开始到 RTMP,然后从 RTMP 服务器通过 VLC 流式传输到 HTTP stream。 I have created the following HTML 5 Audio side:我创建了以下 HTML 5 音频端:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <audio controls="controls" runat="server" autoplay="autoplay">
        <source src="http://innoszorn.ddnss.de:11001/stream.ogg" type="audio/ogg" />
    </audio>
</body>
</html>

Running the side in the Visual Studio 2017 envirnonment the player works.在 Visual Studio 2017 环境中运行播放器工作的一面。 But after publishing the project to the IIS Server the player doesn't work anymore.但是在将项目发布到 IIS 服务器后,播放器不再工作。 Also with VLC you can connect to the stream.您还可以使用 VLC 连接到 stream。

Try to add the mime type in iis.IIS won't serve.ogg files until you tell it about the type.尝试在 iis.IIS 中添加 mime 类型,直到你告诉它类型。 add below code in your web.config file:在 web.config 文件中添加以下代码:

<system.webServer>
  <staticContent>
    <mimeMap fileExtension=".ogg" mimeType="audio/ogg" />
  </staticContent>
</system.webServer>

you could also use iis manager to add the mime type:您还可以使用 iis 管理器添加 mime 类型:

1)open iis manager. 1)打开 iis 管理器。

2)select your site. 2)选择您的网站。

3)double click on the mime type feature from the middle pane. 3) 双击中间窗格中的 mime 类型功能。

在此处输入图像描述

4)click on the add from the action pane 4)单击操作窗格中的添加

在此处输入图像描述

5)add file extension and mime-type as shown below: 5)添加文件扩展名和mime类型,如下所示:

在此处输入图像描述

6)click ok and restart the site and browse it. 6)单击确定并重新启动站点并浏览它。

Note: Make sure the file is available in the site folder.注意:确保该文件在站点文件夹中可用。 iusr and iis_iusrs have full permission to access the site folder. iusr 和 iis_iusrs 拥有访问站点文件夹的完全权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM