I have .mp4 file store in a folder in my app called "Videos". I've tried getting this to work with html5, silverlight, and windows media player. I can not get the .mp4 files to play. What is odd is that I can get a .wmv file to play. Here is what I've tried
in my view
@{ var param3 = "http://localhost:56670/Videos/" + @Model.Path;}
<video width="320" height="240" controls="controls">
<source src=@param3 type="video/mp4" />
<source src=@param3 type="video/ogg" />
Your browser does not support the video tag.
</video>
/////////////////
@{ var playerPath = @Url.Content("~/Videos/VideoPlayer.xap");
}
@{ var param = "mediaUrl=http://localhost:56670/Videos/" + @Model.Path; }
@{ var param2 = "mediaUrl=" + @Request.UrlReferrer + "Videos/" + @Model.Path; }
@Video.Silverlight(
path: playerPath,
width: "400",
height: "420",
bgColor: "red",
autoUpgrade: true,
initParameters: param
)
/////////////
<object type="application/x-silverlight-2" data="data:application/x-silverlight-2," width="512" height="288">
<param name="minRuntimeVersion" value="4.0.50401.0"/>
<param name="source" value=@playerPath/>
<param name="initParams" value=@param2/>
</object>
I can't seem to get any of these to work. Any help on what I'm doing wrong?
thanks
ironman99
Member
76 Points
80 Posts
how to get video to play in the browser
Mar 02, 2012 05:07 AM|LINK
I have .mp4 file store in a folder in my app called "Videos". I've tried getting this to work with html5, silverlight, and windows media player. I can not get the .mp4 files to play. What is odd is that I can get a .wmv file to play. Here is what I've tried in my view
@{ var param3 = "http://localhost:56670/Videos/" + @Model.Path;} <video width="320" height="240" controls="controls"> <source src=@param3 type="video/mp4" /> <source src=@param3 type="video/ogg" /> Your browser does not support the video tag. </video> ///////////////// @{ var playerPath = @Url.Content("~/Videos/VideoPlayer.xap"); } @{ var param = "mediaUrl=http://localhost:56670/Videos/" + @Model.Path; } @{ var param2 = "mediaUrl=" + @Request.UrlReferrer + "Videos/" + @Model.Path; } @Video.Silverlight( path: playerPath, width: "400", height: "420", bgColor: "red", autoUpgrade: true, initParameters: param ) ///////////// <object type="application/x-silverlight-2" data="data:application/x-silverlight-2," width="512" height="288"> <param name="minRuntimeVersion" value="4.0.50401.0"/> <param name="source" value=@playerPath/> <param name="initParams" value=@param2/> </object> I can't seem to get any of these to work. Any help on what I'm doing wrong? thanksvideo Silverlight
ignatandrei
All-Star
134947 Points
21626 Posts
Moderator
MVP
Re: how to get video to play in the browser
Mar 02, 2012 06:57 AM|LINK
1.
This should be Server,MapPath("~/Videos/")
2.
Does your xap play .mp4 files?
ironman99
Member
76 Points
80 Posts
Re: how to get video to play in the browser
Mar 02, 2012 01:55 PM|LINK
This gives me a path like this "c:\\users\\.....\\desktop\\appname\\Videos\\filename.mp4 "
this doesn't work either.
how would I know?
thanks,
ignatandrei
All-Star
134947 Points
21626 Posts
Moderator
MVP
Re: how to get video to play in the browser
Mar 02, 2012 02:48 PM|LINK
You did not do the xap file? From where did you get?
ironman99
Member
76 Points
80 Posts
Re: how to get video to play in the browser
Mar 02, 2012 07:11 PM|LINK
I'm brand new with silver light. I got it from here http://slvideoplayer.codeplex.com/wikipage?title=installation%20instructions
thanks,