如何将视频播放到支持所有浏览器和支持格式的asp.net页面? [英] How to play a video into a asp.net page which support all browsers and support format?
问题描述
大家好。
我想在我的网站上添加一个视频播放选项吗?请告诉我如何将视频添加到我的asp.net页面中,该页面支持所有格式并在每个浏览器上播放。
我尝试过html视频标签,但它不能正常工作
这里是我的页面来源
Hello everyone
I wanna to add an option of video play into my website?please tell me how can add video into my asp.net page which support all formats and play on every browser.
I tried html video tag but it is not working
here is the source of my page
<pre><pre lang="HTML">
UPLOAD VIDEO:< asp:FileUpload ID =FileUpload1 runat =server/>
< asp:Button ID =Button1runat =serveronclick =Button1_Click
Te xt =上传视频/>
< asp:标签ID =Label1runat =serverText =>
< asp:ListView ID =ListView1runat =serverDataSourceID =SqlDataSource1>
< layouttemplate>
< table id =tb1runat =server>
< tr id =itemPlaceHolderrunat =server>
< itemtemplate>
< tr runat =server>
< td runat =server>
< object id =mediaPlayerclassid ='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95'repeed ='正在加载。 ...'
viewastext class ='MediaPlayerWidth'>
< param name = fileNamevalue =<%#Eval(videopath =)%> />
< param name =animationatStartvalue =false/>
< param name =transparentatStartvalue =false/>
< param name =autoStartvalue =false/> < br $>
< param name =showControlsvalue =true/>
< param name =clickToPlayvalue =true/>
< param name =ShowStatusBarvalue =true/>
< param name =windowlessVideovalue =true/>
< embed type =application / x-mplayer2pluginspage =http://microsoft.com/windows/
mediaplayer / en / download /id =name =mediaPlayerclass =MediaPlayerWidthsrc = <%#的eval( 将videoPath)%>中> < / embed>
< / object>
< asp:SqlDataSource ID =SqlDataSource1runat =server
ConnectionString = <%$ ConnectionStrings:demoConnectionString2%>
SelectCommand =SELECT * FROM [UploadVideos]>
< / form>
< / body>
< / html>
UPLOAD VIDEO :<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Upload Video" />
<asp:Label ID="Label1" runat="server" Text="">
<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">
<layouttemplate>
<table id="tb1" runat="server">
<tr id="itemPlaceHolder" runat="server">
<itemtemplate>
<tr runat="server">
<td runat="server">
<object id="mediaPlayer" classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' standby='Loading....'
viewastext class='MediaPlayerWidth'>
<param name="fileName" value="<%#Eval(" videopath=")%>" />
<param name="animationatStart" value="false" />
<param name="transparentatStart" value="false" />
<param name="autoStart" value="false" />
<param name="showControls" value="true" />
<param name="clickToPlay" value="true" />
<param name="ShowStatusBar" value="true" />
<param name="windowlessVideo" value="true" />
<embed type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/
mediaplayer/en/download/" id="" name="mediaPlayer" class="MediaPlayerWidth" src="<%#Eval("Videopath")%>"> </embed>
</object>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:demoConnectionString2 %>"
SelectCommand="SELECT * FROM [UploadVideos]">
</form>
</body>
</html>
推荐答案
ConnectionStrings:demoConnectionString2%>
SelectCommand =SELECT * FROM [UploadVideos]>
< / form>
< / body>
< / html>
ConnectionStrings:demoConnectionString2 %>"
SelectCommand="SELECT * FROM [UploadVideos]">
</form>
</body>
</html>
我不确定,但我不认为没有一个适合所有将视频嵌入到支持所有浏览器的网页的方法。您可能需要为每个浏览器稍微调整一下。由于您还没有共享您的代码,我无法对其进行评论或改进它。
但是这里有一些参考链接:
解决方法:将视频或音频媒体添加到Web应用程序 [ ^ ]
如何在ASP.NET中播放Flash视频文件 [ ^ ]
ASPNetFlashVideo for ASP.NET [ ^ ]
此外,如果你的主要目的是展示视频,你可以轻松地将视频ASP.Net MVC3与Razor一起嵌入。用法示例:
Silverlight:
Video.Silverlight(文件名,宽度,高度)
Flash:
Video.Flash(文件名[,宽度,高度])
媒体播放器:
Video.MediaPlayer(文件名[,宽度,高度])
祝你好运,
OI
I am not certain but I don't think there isn't one fits all approach for video embedding into your webpage which supports all browsers. You may need to tweak a little for each browser. Since you haven't shared your code I can not comment on it or improve it.
But here are some reference links for you:
Walkthrough: Adding Video or Audio Media to a Web Application[^]
How To Play Flash Video Files In ASP.NET[^]
ASPNetFlashVideo for ASP.NET[^]
Also, you can embed videos ASP.Net MVC3 with the Razor easily if your main purpose is showing videos. Example usage:
Silverlight:
Video.Silverlight(filename, width, height)
Flash:
Video.Flash(filename [, width, height])
Media Player:
Video.MediaPlayer(filename [, width, height])
Good luck,
OI
这篇关于如何将视频播放到支持所有浏览器和支持格式的asp.net页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!