Wednesday, November 9, 2011

How to add windows media player in asp.net web page


First you create a web page to open asp.net. than add this code in asp.net web form page.

<div>
     <embed type="application/x-mplayer2" width="300" height="300" src="Bir me tanhai me.DAT" showstatusbar="1">
        <param name="AutoStart" value="1" />
     </embed>
</div>

In this code :

Embed tag is used to add media player in web page.

1)    Type: Type attribute is type of player.
2)    Width & Height: width or Height is size of player.
3)    SRC: Src is a path of video or audio file to play.
4)    Showstatusbar : it is used to display a status bar of media player.
5)    Param : param tag is used to auto run a player to run a web page. If value is 1 then auto starts a player to runs webpage. If value is 0 then player is not default start.

Step to add windows media player in asp.net webpage :
Step 1) Open asp.net web forms. After add audio or video file for play in player.
        Right click in project in solution explorer then choose add existing item. Then open a dialog box. You select audio or video file. After add this file show in solution explorer.
code for add media player in asp.net

Step 2) After adding file then you write embed code in web form in html view. For create media player.
   
<div>
     <embed type="application/x-mplayer2" width="300" height="300" src="Bir me tanhai me.DAT" showstatusbar="1">
        <param name="AutoStart" value="1" />
     </embed>
</div>


Step 3) After adding code to run a web form. A media player show in web page in running mode.
display a windows mediaplayer in asp.net web forms.