0

I have an asp.net page, I want to play a video in it. I've tried using <video> and <Object>, but nothing worked. Either the video appears as a white block, or it doesn't appear at all.

I'm trying to play .wmv file which is stored in the localhost in Images folder. Here are some code samples I tried:

<video width="320" height="240" controls="controls">

  <source src="~/Images/file.wmv" type="video/mp4">
  <source src="~/Images/file.wmv" type="video/ogg">
 <source src="~/Images/file.wmv" type="video/wmv">
<source src="~/Images/file.wmv" type="video/ogv">

  Your browser does not support the video tag.
</video>

Also, this one:

 <object width="425" height="344">
                <embed src="file.wmv" width="425" height="344"></embed>
                </object>

And this one:

<object width="425" height="344">
    <param name="file" value="~/Images/file.wmv"></param>
    <param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>
    <embed src="localhost/Images/file.wmv" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed>
</object>

None of the code samples above worked. Can you please tell me how can I fix this problem?

Also, what if the user will upload some video file to the server (and I have no prior knowledge about its type, it may be .wmv, .swf, etc.) What coding technique would support playing a variety of video types?

Thanks.

Dania
  • 1,648
  • 4
  • 31
  • 57
  • First, what browser are you using? – Sain Pradeep Dec 11 '15 at 12:44
  • Are you added MIME Type in Web Config ? – Rajeesh Menoth Dec 11 '15 at 12:44
  • @SainPradeep Firefox, I tried IE but it didn't display too. – Dania Dec 11 '15 at 12:45
  • Is your browser is updated to latest version? because you are getting this "Your browser does not support the video tag." – Sain Pradeep Dec 11 '15 at 12:45
  • @rajeeshmenoth no I didn't. Shall I do that? If yes, will that confine the video types that the user can upload to the server? – Dania Dec 11 '15 at 12:46
  • @SainPradeep, I don't think IE is updated, but for Firefox I use 42.0, I've checked it and found that it's updated. – Dania Dec 11 '15 at 12:47
  • @SainPradeep I added "Your browser does not support the video tag." in the code to appear for any user who use a browser that doesn't support video tag. It doesn't appear to me when I run the page. – Dania Dec 11 '15 at 12:50
  • @Dania I think yes.Put a permission in server also.please check this link http://stackoverflow.com/questions/23260092/how-can-i-play-wmv-video-in-html-player – Rajeesh Menoth Dec 11 '15 at 12:54
  • @rajeeshmenoth, thanks, this is the first time I deal with videos in asp.net, can you please help me? What code exactly shall I write and where? The video will be stored on the server. Thanks. – Dania Dec 11 '15 at 12:56
  • There is no way. No browser (currently, if ever) supports playing wmv files. You will have to convert it into a format that browsers know how to play. Ref Link http://stackoverflow.com/a/4459949/795683 – Sain Pradeep Dec 11 '15 at 13:00
  • @SainPradeep, thanks, after some searching I found that .swf is the most commonly used format, but I can't know which code samples of the ones shown above would play it properly. How can I display it from the localhost? – Dania Dec 11 '15 at 13:06
  • @Dania Add this format in Web config.. – Rajeesh Menoth Dec 11 '15 at 13:08
  • @rajeeshmenoth thank you, I added it to the web.config, and used the first code sample in the question. I get a box for displaying the video, but it doesn't play, it's written "No video with supported format and MIME type found" is it because of the path ~/Images/file.wmv? can you please tell me what is causing the problem? – Dania Dec 11 '15 at 13:19
  • Just add this . If it is not working just change the mimeType "video/x-ms-wmv" – Rajeesh Menoth Dec 11 '15 at 13:23
  • @rajeeshmenoth, thank you, but this didn't work either. Is it related to the browser itself? This website says that firefox only plays .webm, http://easyhtml5video.com/rq/no-video-with-supported-format-and-mime-type-found-error-with-ogg-video-converter-download-2Y.html – Dania Dec 11 '15 at 13:30
  • Check other format also becoz then only we know the exact issue more ref : http://www.rackspace.com/knowledge_center/article/define-mime-types-on-your-windowsiis-based-site – Rajeesh Menoth Dec 11 '15 at 13:35
  • @rajeeshmenoth, thank you. I tried .mp4 and even .webm, nothing worked. Maybe it's from the browser itself. Thank you for your help. – Dania Dec 11 '15 at 13:56

0 Answers0