Windows Forms: Add / Embed YouTube Videos in C#
By FoxLearn 3/18/2020 6:51:54 PM 12.83K
You can easily embed flash player into winform allows you to view YouTube videos.
Opening your Visual Studio, then click New Project. Next, You need to select Visual C# on the left, then Windows and then select Windows Forms Application. Name your project "FlashEmbed" and then click OK button.
Adding a reference to AxShockwaveFlashObjects library. Your computer needs to install flash player software.
Opening your form designer, then drag Label, Button, TextBox and axShockwaveFlash to your form designer, then you can design a simple form as shown below.
Adding a click event handler to the Go button that allows you to view youtube videos in c# windows forms application.
//c# embed youtube/videos in your winforms private void btnGo_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtUrl.Text)) { //Get url video string url = txtUrl.Text.Replace("watch?v=", "v/"); axShockwaveFlash.Movie = url; axShockwaveFlash.Play(); } }
VIDEO TUTORIAL
- Windows Forms: Youtube Search with Paging in C#
- Windows Forms: Text to speech in C#
- Windows Forms: Print Picture Box in C#
- Windows Forms: Advanced Filter DataGridView in C#
- Windows Forms: Progress Bar in C#
- How to create a Lucky Draw games in C#
- Windows Forms: How to Create a Random Password Generator in C#
- Windows Forms: Tag Control in C#