CodeKicks.com
Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Monday, September 25, 2006

Placing Windows Media Player in ASP.NET web page

<object id="VIDEO" width="320" height="240" 
    style="position:absolute; left:0;top:0;"
    classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
    type="application/x-oleobject">
        <param name="URL" value="your file or url"/>
    <param name="SendPlayStateChangeEvents" value="False"/>
    <param name="AutoStart" value="True"/>
    <param name="uiMode" value="none"/>
    <param name="PlayCount" value="9999"/>
    <param name="Volume" value="9999"/>
</object>
<object id="VIDEO" width="320" height="240" 
    style="position:absolute; left:0;top:0;"
    classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
    type="application/x-oleobject">
        <param name="URL" value="your file or url"/>
    <param name="SendPlayStateChangeEvents" value="False"/>
    <param name="AutoStart" value="True"/>
    <param name="uiMode" value="none"/>
    <param name="PlayCount" value="9999"/>
    <param name="Volume" value="9999"/>
</object>

Post a Comment

dotNetSoldier said...

Here is the demonstration how to embed WMP in asp.net

nishkal said...

Hi thanks for this code.It was very helpful to me. But here i have a query. In my requiremnt i need to place the video string depending on the video id they have choosen to play. I have this video id and video name data in my database.Depending on the videoname i need to play the video.iam storing my videos in a folder of the project. How to do it in this code and change the value of the url programmatically? Please help me and thanks in advance..

sandhya said...

me have to do the same thing.can any one tell me how to do this?
Thanks.

Michael said...

to programattically set the URL of the video, you must build the object tag in the code behind of the web page using a "new HtmlGenericControl("object"). Once you instantiate the HtmlGenericControl object, you can set the ID, and then add attributes for the classid, width, height, etc. Parameters can be added using the innerHTML property. And finally, add the HtmlGenericControl to the collection of controls on the page (this.Controls.Add(myHtmlGenericControl)).

Nikky said...

Thanks for the code provided.
Thanks Michael for your inputs.