Windows Forms: Add / Embed YouTube Videos in C#

This post shows you How to Add or Embed Flash Player to Windows Forms Application in C# .NET

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.

c# flash embed

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.

flash embed in c#

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;