
Originally Posted by
Infinitry
can you guys help me to figure out how to make a youtube video player using VB 2008. I found a code - >
Code:
Dim Str As String = TextBox1.Text.Replace("/watch? v=", "/v/")
AxWindowsMediaPlayer1.URL = Str
.... but its not working. When I press the play button, it just loads -> connecting...bla bla not playing. Any help out there?
thank you

I think you have 2 errors here:
1: You have used a space between ? and v (/watch? v=), so no replacement will take place.
2: I think windows media player cannot load swf ('/v/' loads swf not flv).
Here is what you need to do in order to play:
Create a project.
On the toolbox, right click any item and click "Choose Items" as shown;
Now select the "Shockwave Flash Object" from the COM components and click "OK".
Now the object will appear in the toolbox. Drag it to the form and dock it to the container.
Rename the control to "Ytube".
Double click the form and write the following code:
[php]'Replace the videoID with your video ID
Dim videoID As String = "http://www.youtube.com/watch?v=vnMqkZmuEC0"
'The replacement was your first mistake.
videoID = videoID.Replace("/watch?v=", "/v/")
ytube.Movie = videoID
[/php]
Enjoy the video
