Hi I am fairly new to ASP.Net, but I have been asked to develop a web site for a customer that needs to have Windows Media Player embedded into it to play some media files. I am using Visual Studio 2008, .Net Framework 3.5 and Visual Basic.
Whilst I am able to use the Object and Param tags to show visual studio, where I am struggling is how to pass the filepath to the media player. The object is that the customer clicks on a linkbutton from the girdview to select their media file, which will
then fire up the media player, and problem is how to pass to this filepath to the media player. However, the added problem is that the client machines will not have javascript enabled on them, and therefore, my solution has to use that does not use javascript.
The path to the media file is specified within the object tag. So you don't need to use javascript- you can write the parameter from your server-side code. i.e. in your page markup you might have something like this:
Thanks for your reply, but the code you have given me behind the page is in C#. Unfortunately, I am using VB.Net, and therefore, could you give me the Visual Basic equilvalent, please?
Yes, I did try using Me. before emailing you, but the id of the param for the url did not appear in the list of objects to add the filepath. Is there something else I need to do, or is there something else I need to add to my code, i.e. COM, etc?
Thanks for your reply! Sorry, yes, I clearly forget that. I can see it now I have added the runat="server" attribute. Unfortunately, when I add the line of code, and click play, it says "connecting to media", then goes back to "ready". I have two test files
- a wav and wmv, do you have to add an onload on the param tag, or do you add something else to another tag?
There is a free Windows Media Player ASP.NET custom control, which may make the process of embedding the media in the page a little easier-
you can download it from here. HTH
AndyMoireASP
Member
53 Points
742 Posts
How to pass a filepath to Windows Media Player not involving JavaScript - URGENT
Jan 17, 2009 02:47 PM|LINK
Hi I am fairly new to ASP.Net, but I have been asked to develop a web site for a customer that needs to have Windows Media Player embedded into it to play some media files. I am using Visual Studio 2008, .Net Framework 3.5 and Visual Basic.
Whilst I am able to use the Object and Param tags to show visual studio, where I am struggling is how to pass the filepath to the media player. The object is that the customer clicks on a linkbutton from the girdview to select their media file, which will then fire up the media player, and problem is how to pass to this filepath to the media player. However, the added problem is that the client machines will not have javascript enabled on them, and therefore, my solution has to use that does not use javascript.
Can only help me out as it is rather urgent??!!
Thanks
booler
Star
14342 Points
2205 Posts
Re: How to pass a filepath to Windows Media Player not involving JavaScript - URGENT
Jan 17, 2009 07:00 PM|LINK
The path to the media file is specified within the object tag. So you don't need to use javascript- you can write the parameter from your server-side code. i.e. in your page markup you might have something like this:
<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" runat="server" id="paramMediaPath" /> <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>Then in your code behind, you can do this:
AndyMoireASP
Member
53 Points
742 Posts
Re: How to pass a filepath to Windows Media Player not involving JavaScript - URGENT
Jan 18, 2009 10:36 AM|LINK
Hi
Thanks for your reply, but the code you have given me behind the page is in C#. Unfortunately, I am using VB.Net, and therefore, could you give me the Visual Basic equilvalent, please?
booler
Star
14342 Points
2205 Posts
Re: How to pass a filepath to Windows Media Player not involving JavaScript - URGENT
Jan 18, 2009 12:34 PM|LINK
It's not very different:
Me.paramMediaPath.Attributes.Add("value", "your_media_path")BTW- this online utility can convert between c# and VB.NET. HTH.
AndyMoireASP
Member
53 Points
742 Posts
Re: How to pass a filepath to Windows Media Player not involving JavaScript - URGENT
Jan 18, 2009 02:05 PM|LINK
Hi
Yes, I did try using Me. before emailing you, but the id of the param for the url did not appear in the list of objects to add the filepath. Is there something else I need to do, or is there something else I need to add to my code, i.e. COM, etc?
booler
Star
14342 Points
2205 Posts
Re: How to pass a filepath to Windows Media Player not involving JavaScript - URGENT
Jan 18, 2009 03:40 PM|LINK
If you added the runat=server attribute as in the above example, it should appear. What version of ASP.NET are you using?
AndyMoireASP
Member
53 Points
742 Posts
Re: How to pass a filepath to Windows Media Player not involving JavaScript - URGENT
Jan 18, 2009 08:00 PM|LINK
Hi
Thanks for your reply! Sorry, yes, I clearly forget that. I can see it now I have added the runat="server" attribute. Unfortunately, when I add the line of code, and click play, it says "connecting to media", then goes back to "ready". I have two test files - a wav and wmv, do you have to add an onload on the param tag, or do you add something else to another tag?
Thanks for all your help!
booler
Star
14342 Points
2205 Posts
Re: How to pass a filepath to Windows Media Player not involving JavaScript - URGENT
Jan 18, 2009 09:26 PM|LINK
Hi,
There is a free Windows Media Player ASP.NET custom control, which may make the process of embedding the media in the page a little easier- you can download it from here. HTH
AndyMoireASP
Member
53 Points
742 Posts
Re: How to pass a filepath to Windows Media Player not involving JavaScript - URGENT
Jan 19, 2009 08:18 PM|LINK
Hi
I managed to get to work now without looking at the other website you have sent me! Thank you for all your help, you have been kind and helpful to me!