gpt4 book ai didi

asp.net - IE 错误无效源 HTML5 音频 - 解决方法

转载 作者:太空狗 更新时间:2023-10-29 13:52:49 24 4
gpt4 key购买 nike

我(和大约一百万其他人)在 IE11 中发现了一个错误(不确定其他版本是否有相同的错误),如果您创建 HTML5 音频标签,浏览器无论如何都会报告“无效源”。我已经尝试了所有我能想到的组合,但没有成功。到目前为止:

  • 将 HTML 结束标记从自闭合更改为显式
  • 更改文件名以消除任何奇怪的字符
  • 将音频子格式更改为所有可能的设置
  • 添加显式 URI(“http://...”)
  • 禁用所有插件(有库存插件)
  • 尝试所有可能的音频格式
  • 定义 MIME 类型
  • 更改音频标签的参数。
  • 更改了 IIS 设置以包含 MIME 类型。

我查看了 Microsoft 的“Connect”网站。他们声称它不可重现,但成千上万的谷歌结果表明并非如此。

这根本不可能吗?我尝试过的所有其他最新和最好的浏览器都可以工作(Firefox、Opera、Safari、Chrome)。没有解决方案。

代码如下:

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="AudioPopupPlayer.aspx.vb" Inherits="AudioPopupPlayer" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div style="padding-top: 30px; margin: auto; width: 300px;">
<asp:Literal ID="litVoiceOver" runat="server"></asp:Literal></div>
</body>
</html>

代码隐藏:

Partial Class AudioPopupPlayer
Inherits System.Web.UI.Page

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim VoiceOverFileName As String = Request.QueryString("vo")
If VoiceOverFileName.Length > 0 Then
Dim root As String = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + ResolveUrl("~/")
Dim audiosource As String = "<audio id=""VoiceOver"" autoplay=""autoplay"" preload=""preload"" controls=""controls""><source src=""" & root & "audio/" & VoiceOverFileName & ".ogg"" type=""audio/ogg"" ></source><source src=""" & root & "audio/" & VoiceOverFileName & ".mp3"" type=""audio/mpeg"" ></source><source src=""" & root & "audio/" & VoiceOverFileName & ".wav"" type=""audio/wav"" ></source></audio>"
Me.litVoiceOver.Text = audiosource
End If
End Sub

End Class

最后,一张屏幕截图(在 IE11 中)显示 HTML 已完美呈现,但我仍然收到可怕的“无效源”消息(注意:复制和粘贴链接会导致音频文件播放 - 看图) .

bug in IE 11

最佳答案

我在尝试使用简单的 HTML5 代码时遇到了同样的问题。 url 和文件名也是正确的。这对我有用:

<audio src="song.mp3" controls autoplay></audio>

如果不需要它们,您可以删除控件,它仍然可以工作。希望对您有所帮助!

关于asp.net - IE 错误无效源 HTML5 音频 - 解决方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24213302/

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