好吧,为了支持旧浏览器,我需要在我的应用程序上显示一些视频而不使用HTML5 /来显示它们并播放它们,实现这一目标的最佳方法是什么?
我使用VB用户控件将HTML5视频提供给较新的浏览器。
我的代码:
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="VideoPlayer.ascx.vb"
Inherits="Online.VideoPlayer" %>
<table cellpadding="0" cellspacing="0">
<tr visible="false" id="rwError" runat="server">
<td style="padding-left: 5px; width: 100%;">
<asp:Label ID="lblError" runat="server" Text="<% Resources: Dictionary, FoutOpgetreden %>"
Font-Names="Verdana" Font-Size="9pt" ForeColor="#3C3C3E" Font-Bold="true" EnableTheming="false" />
</td>
</tr>
<tr>
<td>
<video id="player" width="100%" height="auto" title="" controls onclick="this.play();"
runat="server" />
<embed id="playerOld" width="100%" height="auto" title="" style="display: none" type="application/mp4"
runat="server" />
</td>
</tr>
</table>
<script type="text/javascript">
var isHtml5Compatible = document.createElement('canvas').getContext != undefined;
if (!isHtml5Compatible) {
var oldPlayer = document.getElementById("<%= playerOld.ClientID %>");
oldPlayer.style.display = "block";
alert(oldPlayer.style.display);
}
</script>