I have an ASP website that plays a video depending on the HTTP parameter 'id'
Server side:
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
Client Side:
<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>
So I am passing the video path in the virtual directory in the global variable vidurl
When I play this on Google Chrome for Desktop, I only hear the sound in the video, with a black image.
When I play it on mobile, a black video appears, but It doesn't play anything at all.
What can be the problem?
Please note that all the videos in the virtual directory are in mp4 format.
UPDATE:
I went to the Codec Information in my Video,
It says : MPEG-4 Video (mp4v)
Could that be the problem?
Priority is for the video to work on mobiles.
Some file formats are not supported on some browsers. Try adding additional sources of web video formats.
<source src="somevideo.webm" type="video/webm">
Unfortunately playing video across all the browsers is pain in the ***. For me solution that still works the best is mediaelement.js (even ie8). Set up is quite easy and is quite brodly used library recommended by the best brains in front end world. The only problem is that is really hard to make it responsive when using flash fallback.
Even when you supply all the possible formats you still will see multiple issues like giving wrong time of video, different control options across devices. Also some converters don't work well when it comes to keeping standards for web. the best one for me is http://www.mirovideoconverter.com/ for mac. Also support of formats/codecs varies depending on browse * operation system * installed programmes so is always good to use something as fallback (flash).
There are few other newer libraries you can use other then mediaelement, but in my test most of them worked quite poorly. The best one was video.js (polyfill alike) and popcorn player.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With