我有一个 ASP 网站,它根据 HTTP 参数 'id'
播放视频
服务器端:
Public vidurl As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim id As String = Request.QueryString("id")
Dim DT As New DataTable
Dim vidInfo As VideoInfo
Try
If id IsNot Nothing Then
Dim SQLConnection_Cont As New SqlConnection(SQLConntStr)
DT = f.GetVideoInfo(id, SQLConnection_Cont)
If DT IsNot Nothing Then
If DT.Rows.Count > 0 Then
vidInfo = New VideoInfo With {
.ID = DT.Rows(0).Item("FTPID"),
.Processed = DT.Rows(0).Item("Processed"),
.URL = DT.Rows(0).Item("URL"),
.VideoName = DT.Rows(0).Item("VideoName"),
.VidID = DT.Rows(0).Item("VidID"),
.Created = DT.Rows(0).Item("Created"),
.MonthDiff = DT.Rows(0).Item("Monthdiff")}
If vidInfo.MonthDiff = 0 Then
vidurl = "http://webpath.com/virtualdirectory/content/" & vidInfo.VideoName
End If
End If
End If
End If
Catch ex As Exception
WriteExToFile("Video.aspx.vb", ex.ToString)
End Try
End Sub
客户端:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Video Player</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="vidplay">
<video height="400" controls style="position: relative; top: 23px;">
<source src=<%= vidurl %> type="video/mp4" codecs="avc1.42E01E, mp4a.40.2"/>
<object data=src=<%= vidurl %> width="320" height="240"></object>
</video>
</div>
</div>
</form>
</body>
</html>
所以我在全局变量 vidurl
当我在桌面版 Google Chrome 上播放此视频时,我只听到视频中的声音,并带有黑色图像。
当我在手机上播放时,出现黑色视频,但根本没有播放任何内容。
可能是什么问题?
请注意,虚拟目录中的所有视频均为 mp4 格式。
更新:
我去了视频中的编解码器信息,
上面写着:MPEG-4 视频 (mp4v)
会不会是这个问题?
优先考虑在手机上播放视频。
最佳答案
某些浏览器不支持某些文件格式。尝试添加其他网络视频格式来源。
<source src="somevideo.webm" type="video/webm">
关于asp.net - 视频标签不适用于移动设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30908964/