gpt4 book ai didi

asp.net - 尝试播放ASP.net中Google Chrome中客户端计算机中存储的音频文件(wav)时未出现音频播放器

转载 作者:行者123 更新时间:2023-12-03 02:01:47 26 4
gpt4 key购买 nike

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm11.aspx.cs" Inherits="omos.WebForm11" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<object data="file:\\\n:\test\abc.wav" style="width: 100px" />
</div>
</form>
</body>
</html>

我的ASP页面将调用上面的html页面。它在IE中运行良好(音频播放器出现并开始播放),但对于谷歌浏览器,音频播放器未显示。音频文件n:\ test \ abc.wav存储在另一个文件服务器中(即驱动器不是Web服务器)。如果我将音频文件存储在Web服务器中,则IE和Google Chrome都可以正常工作,但是我的音频文件必须位于另一台服务器中。
为什么IE可以运行而Google Chrome不能运行(相同的代码),为什么这样呢?我很头疼,有人吃了帕那朵吗?

最佳答案

以下代码应该工作:
注意:我们已 checkin IE 10和最新版本。可能不支持IE-8 / 9。请包涵。

 <!DOCTYPE html>
<html>
<head>

<script type="text/javascript">

var activeobj = 0;
if (window.ActiveXObject) {
document.write("<object data='horse.wav' style='width:400px;' />");
} else {
document.write("<audio controls><source src='horse.mp3' type='audio/mpeg'> Your browser does not support the audio element.</audio>");
}
</script>
</head>

<body>
<div>
</div>
</body>
</html>

关于asp.net - 尝试播放ASP.net中Google Chrome中客户端计算机中存储的音频文件(wav)时未出现音频播放器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30864527/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com