Click here to Skip to main content
15,879,474 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to Play audio / Video Files in Asp.net.
Should i need to add any plug in to play the Files or can i find any control for that!. please kindly help me..

Thanks in advance
Veera Anil
Posted

XML
Hi,
  in asp.net a Literal control will help u to play video and Audio
just drag it in your page and in aspx.cs page
write following code
 string myobj = "";

        myobj += "<video width='462'  controls='controls' data-setup='{}'>";
        myobj += "<source src='http://www.yourdomain.com/videos/Video.mp4' type='video/ogg' />";

        myobj += "Your browser does not support video";

        myobj += "</object>";
        myobj += "</video>";

        Literal1.Text = myobj;
Note- video path must be same as above

for audio replace script by Following

<audio controls="controls">
  <source src="song.ogg" type="audio/ogg" />
  <source src="song.mp3" type="audio/mpeg" />
  Your browser does not support the audio element.
</audio>


Hope this help u
best Luck
Happy Coding :)
 
Share this answer
 
Please refer following threads:

Streaming Media[^]
Web Video in ASP.NET[^]

Have a look: how to play a video file in asp.net[^]
 
Share this answer
 
v2
Comments
Rashmi Shrirame 4-Nov-12 23:58pm    
how to run video in asp.net simple code

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900