WINDOWS FORMS: ADD / EMBED YOUTUBE VIDEOS IN C#

1531

Add / Embed Flash Player to Windows Form Application allows you to view YouTube Videos in C#

Step 1: Click New Project, then select Visual C# on the left, then Windows and then select Windows Forms Application. Name your project “FlashEmbed” and then click OK

Step 2: Design your form as below

Step 3: Add a reference to AxShockwaveFlashObjects library

 

 

Step 4: Add code to handle your form as below

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FlashEmbed
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

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();
}
}
}
}