I am using asp.net mvc, and I'd like to add media player control开发者_C百科 in my view page, so how do I do that?
My first three google finds:
1) A control (doesn't know if it works with mvc though)
http://www.beansoftware.com/free-asp.net-controls/asp.net-media-player-control.aspx
2) Silverlight Player
http://www.asp.net/aspnet-in-net-35-sp1/videos/introduction-to-the-aspnet-mediaplayer-control
3) Embed if it doesnt matter which mediaplayer will be used:
<embed id="videocontent" width="550" height="480" type="video/avi" autstart="true" loop="false" runat="server" style="border: gray 1px solid"></embed>.
or in valid xhtml
<object classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" id="player" width="320" height="260">
<param name="url" value="<%= ViewData["src"] %>" />
<param name="src" value="<%= ViewData["src"] %>" />
<param name="showcontrols" value="true" />
<param name="autostart" value="true" />
<!--[if !IE]>-->
<object type="video/x-ms-wmv" data="<%= ViewData["src"] %>" width="320" height="260">
<param name="src" value="<%= ViewData["src"] %>" />
<param name="autostart" value="true" />
<param name="controller" value="true" />
</object>
<!--<![endif]-->
</object>
+1 to Christina, but #1 may not work in an MVC app.
Her answers, plus you'll want to create a controller action that returns a FileResult. Check this question (its about an image, but a file is a file all the web round):
Can an ASP.NET MVC controller return an Image?
精彩评论