![]() |
|
[.NET] [TUT] Embedding youtube videos into a windows form - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] [TUT] Embedding youtube videos into a windows form (/showthread.php?tid=1562117) Pages: Pages
1
2
|
[TUT] Embedding youtube videos into a windows form - ***** - Aug 4, 2011 So you want to embed youtube videos into your form, well read on Step One, the form Needless to say, open visual studio (or any of the express versions), and create a new windows form application in the language of your choice. in the toolbox, find the components tab [img]http://img688.imageshack.us/img688/2964/flash1u.jpg[/img] right click the tab, and click on "Choose Items" [img]http://img33.imageshack.us/img33/5053/flash2ny.jpg[/img] go to "Com components" and check the box next to "shockwave flash object", than click "OK" [img]http://img27.imageshack.us/img27/7563/flash3w.jpg[/img] Create a form that looks like this: [img]http://img607.imageshack.us/img607/466/flash4.jpg[/img] with one shockwave flash object, one textbox (txtlink), and one button and we are done the formπ€ Step Two, the code the movie property is what determines the video played by the shock wave flash object. so, you would think that the obvious step is to double click the button, and use the following code: Code AxShockwaveFlash1.Movie = txtlink.Texthowever, it will not work. Why? because this is the link you get from youtube: Code http://www.youtube.com/watch?v=kq6HRE0wtYIbut the component wants links like this: Code http://www.youtube.com/v/kq6HRE0wtYInotice how the "watch.php" have been removed, and the "=" replaced with a "/" instead, double click the button, and paste the following code: Code Dim linkportions() As StringSo how does this do? Code Dim linkportions() As Stringcreates an array called linkportions() Code If (txtlink.Text.IndexOf("youtube") <> -1) And (txtlink.Text.IndexOf("watch?v=") <> -1) Thenif the link is valid: Code linkportions = Split(txtlink.Text, "watch?v=")Code http://www.youtube.com/Code kq6HRE0wtYICode AxShockwaveFlash1.Movie = linkportions(0) & "v/" & linkportions(1)Code http://www.youtube.com/v/kq6HRE0wtYINow if the link is incorrect, it simply displays a message box saying "Please enter a valid link" and how we are done!π€π€π€ [img]http://img12.imageshack.us/img12/6590/flash5d.jpg[/img] thanks for reading!π€ * - hacku4eva - Aug 4, 2011 thanks for this, can come in handy! * - I.V - Aug 4, 2011 Or, just add a webbrowser, get the YouTube URL: Code http://www.youtube.com/watch?v=QH2-TGUlwu4Code watch?v=Code /v/Code http://www.youtube.com/v/QH2-TGUlwu4Works just as good. But good job on tutorial. * - Dally180 - Aug 4, 2011 This could be usefull for auto video viewer programs such as viewet and vagex to decrease the loading time. * - DJ BrU - Aug 4, 2011 I coded one of these in vb6 a long time ago. Just wanted to point out you can play flash games with it aswell as play videos. Or anything else that uses flash. * - Deceptive - Aug 4, 2011 (Aug 4, 2011 05:01 PM)I.V Wrote: Or, just add a webbrowser, get the YouTube URL: No, I want to make it clear to everyone that WebBrowsers are shit and should not be used. * - SpK - Aug 4, 2011 (Aug 4, 2011 08:23 PM)Deceptive Wrote: No, I want to make it clear to everyone that WebBrowsers are shit and should not be used.Wow, chill your nuts little boy. There is no need for you to jump on the bandwagon for those idiots that do not know the uses for a WebBrowser. Only because you've read a WebBrowser is bad, you immediately start posting stuff like this about it? Let me tell you, there is so much a WebBrowser can do, which I can guarantee you that you will never be able to do with anything. And that's a deal. Before jumping to conclusions, and thinking you're pro because you found about a new component, please do think about what you're saying. * - I.V - Aug 4, 2011 (Aug 4, 2011 08:23 PM)Deceptive Wrote: No, I want to make it clear to everyone that WebBrowsers are shit and should not be used. Yes, if the developer is an obvious dumb ass and can't use other VB.NET webbrowsers such as WebKite, Gecko and etc... Just making it clear to every one as well. Not to say IE 9 is actually pretty good now days. π * - Deceptive - Aug 4, 2011 (Aug 4, 2011 08:31 PM)SpK Wrote: Wow, chill your nuts little boy. There is no need for you to jump on the bandwagon for those idiots that do not know the uses for a WebBrowser. I do think about what I'm saying. I am chill as well, from what I've seen, people use WebBrowsers for YouTube Bots, Shell Booters or fail to use them all together. There is a lot of things the default WebBrowser does not contain that it should, that's why most prefer to use GeckoFX or that other one I can not remember at this time. * - I.V - Aug 4, 2011 (Aug 4, 2011 08:31 PM)SpK Wrote: Wow, chill your nuts little boy. There is no need for you to jump on the bandwagon for those idiots that do not know the uses for a WebBrowser. Oh no, don't worry.. The reply was specifically to me. He does not likes me for reason which I yet do not know. I have PM him asking for what I have done wrong but he ignores me. Thank you though for the support. * - SpK - Aug 4, 2011 (Aug 4, 2011 08:34 PM)Deceptive Wrote: I do think about what I'm saying. I am chill as well, from what I've seen, people use WebBrowsers for YouTube Bots, Shell Booters or fail to use them all together. There is a lot of things the default WebBrowser does not contain that it should, that's why most prefer to use GeckoFX or that other one I can not remember at this time.If you did not know GeckoFX is also referred to as a WebBrowser control. (Aug 4, 2011 08:35 PM)I.V Wrote: Oh no, don't worry.. The reply was specifically to me. He does not likes me for reason which I yet do not know. I have PM him asking for what I have done wrong but he ignores me.Hey retard, if you had something called a brain in your skull, my quote was to the OP, and the post was before yours. * - I.V - Aug 4, 2011 (Aug 4, 2011 08:40 PM)SpK Wrote: If you did not know GeckoFX is also referred to as a WebBrowser control. If you would carefully read what I wrote, I'm with you, and I was actually defending you. Sorry if it did not sound like that. π€ * - Deceptive - Aug 4, 2011 (Aug 4, 2011 08:40 PM)SpK Wrote: If you did not know GeckoFX is also referred to as a WebBrowser control. I'm sorry for not constantly checking the date on a post. ._.? * - I.V - Aug 4, 2011 (Aug 4, 2011 08:44 PM)Deceptive Wrote: I'm sorry for not constantly checking the date on a post. ._.? You seem lost. That reply about the 'no brain' was to me. lol... * - Deceptive - Aug 4, 2011 (Aug 4, 2011 08:50 PM)I.V Wrote: You seem lost. That reply about the 'no brain' was to me. lol... Fuck. To lazy to comprehend all these posts to multiple people at the same time. /Thread |