views:

34

answers:

2

Does anyone know how to play music from youtube in my c# .net 4.0 app ? I've installed all the apis and sdks from google but i can't seem to find a tutorial that lets me play music in my desktop app .

regards, Alexandru Badescu

A: 

Here's a tutorial on how to put youtube videos into an MVC app it should help.

http://webpangea.blogspot.com/2009/12/youtube-ms-mvc-and-jquery.html

Axe
i can't get the code, the link is broken.. and anyway i wanted an c# integration, and it appears you worked in vb
Badescu Alexandru
+1  A: 

If it's an asp.net application, you can just embed an object tag in your markup. Check out the "<embed>" button to get the tag info for an individual video.

If it's a Windows Forms or WPF desktop application, why not just embed a browser control with the same tag?

Either way, you should be able to just make the object tag invisible and still be able to hear the music.

Steve Danner
i would like to make a music player that plays from youtube with my own controls designed so web-browsing integration i think is not an option
Badescu Alexandru
I know it might seem kind of like a hack, but you can execute javascript into a browser control which could start and stop the video as the user presses your custom buttons?
Steve Danner
that is a good idea. I'll implement that if no other way is found. Do you know if there is a way to hide the video ? i would like to make my own loading bar for the track . Does Youtube provide playing bar info?
Badescu Alexandru
I don't konw about playing bar info, but you should be able to hide it by applying the css style visibility: hidden to the object tag. display: none will not work properly, however.
Steve Danner