Windows Media Player Control not working as it did with VB .NET Express
I just learned how to use the Windows Media Player control and I had a Windows form working that would connect to a URL and play the video. When I tried to add the control to an ASP .NET website, there were two options for WMP...a dll file and an ocx file. I added the dll file to my toolbox items, but it doesn't show up in the toolbox like it did in VB. I managed to write code without errors that is supposed to do the same thing as my Windows form, but I can't drop the WMP control on the page, so nothing happens. Can someone help me figure out how to put the control on the form so I can see it? I'll show you the code that I have which worked in VB Express.
Partial
Class _DefaultInherits System.Web.UI.PageDim PlayerAsNew WMPLib.WindowsMediaPlayerProtectedSub Button1_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles Button1.ClickPlayer.enabled =
TruePlayer.URL =
"http://blakenet.myftp.org:8888"EndSubEnd
Class
[2060 byte] By [
Blake81] at [2007-12-24]
Hi!
As far as I know ASP.NET have very different basic rules than WinForms, so you can't drop it on page and expect it work. You need embed HTML object for Windows Media Player and communicate with it. I think easiest way is to open any site with embedded player and take a look at the code that display player.
Thank you, that worked for me. I do have another question, and I'm not sure if this is the right forum. Is there a control for Windows Media Encoder to use in applications? That would be perfect for some things I'd like to do if I could include WME in my code. I figure I could probably implement voice and webcam support if I could use that control.
I found the answer to the Windows Media Encoder question. The URL is really long, but I'll post it in case anyone is interested.
http://msdn.microsoft.com/library/shared/deeptree/asp/rightframe.asp?dtcfg=/library/deeptreeconfig.xml&url=/library/en-us/wmencode/htm/sourcegroupscodeexample.asp?frame=true&hidetoc=false
It was a little tricky to figure out at first. I'm not sure if the code is for an older version, but I needed to change lines like this:
Dim Encoder As WMEncoder
to this:
Dim
Encoder As WMEncoderLib.WMEncoder I still need to figure out how I'm going to handle users who will be behind routers, but I'll think of something. I don't think I can expect all of them (even though there won't be many) to sign up for No-IP or DynDNS. Does anyone have any suggestions for ports that could work without problems when routers are involved? What I'm doing is creating a messenger program, and I'd like to use what I just found to add webcam and voice support. Thanks.
You can find about ports in WinSock docs, but generally all ports must be disabled by firewalls, except known system ports and user enabled ports.
OK, thanks. That's going to be tricky then. I'm tossing around ideas for how to handle this. I'm thinking I'll either use a port like 21 or 110 that should be open or have the audio and video sent through my server (which is just a regular PC) and then on to the recipient, if that's possible. Thanks for your help.
I'm not done any TCP stuff last few years, but isn't 21 for FTP protocol? If you use 21 you will make problems to FTP transfers when your chat is used (and since chats used very often, installing your app will disable FTP for client).
I think you can dig into DirectPlay to see how it may help, I mean it has features to search for servers, organize connections and effectively transfer data in peer-to-peer or dedicated server scenarios.
Thanks. I just looked into DirectPlay a bit, and didn't see any good documentation yet. It seems that DirectPlay is deprecated. I'll keep looking though, because it sounds promising.
DirectPlay deprecated? Wow. I program in DirectPlay 8 few years ago and I think DX9 must have this stuff. Docs are really small sometimes, but in DX8 for DirectPlay there was good docs.
do you have any idea how to put windows media player component on windows form, i am using visual basic 2005.
Thanks,
Saurabh
Just like any other ActiveX control - right-click in Toolbox, select Choose Items, select tab COM Components, check Windows Media Player. Now you have WMP control in toolbox - drag on form and use.
How can i use a stream (buffered) to play with this component.The video file is encrypted and decrypting as a whole is not possible. So i'm decrypting it to a buffer(5-10MB) and i need to play this.Is thr any way to do this. I think itz possible here too coz i heard some where network streaming is possible.
Thanz in advance
Tom
Hai,
can post some code to work with streams?. The source file is above 700 MB and is encrypted. I dont want to decrypt it all at onece coz of security reasons. Can u show me how can i stream simple buffers(decrypted chunks) to mediaplayer component to play them? I'm usin VS 2005.
Thnx in advance
Tom
Blake,
I see that you figured this out a long time ago... can you tell me what you found, and if you were able to use your own WMP application within a website? I'm trying to do the same thing:
Created my own windowsform application that has WMP in it with some extra controls
Want to be able to embed it into my website.
Please let me know if you did something similar or if you know how to do that. I have not been able to get guidance on this anywhere (MSDN newsgroups, google) so much for help guaranteed in 2 days...
Thanks again