I have a form that contains a button and a webBrowser. In webBbrowser1 I load a youtube video with this code
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
var embed = "<html><head>" +
"<meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\"/>" +
"</head><body>" +
"<iframe width=\"400\" height=\"400\" src=\"{0}\"" +
"frameborder = \"0\" allow = \"autoplay; encrypted-media;loop\" allowfullscreen></iframe>" +
"</body></html>";
var url = "https://www.youtube.com/embed/X1s4TCcpAQ4?autoplay=1&loop=1";
this.webBrowser1.DocumentText = string.Format(embed, url);
Then I want when I click the button to stop the video.I try this code and works but I dont like very much because is trick and I prefer to understand how works youtube video
private void button1_Click(object sender, EventArgs e)
{
this.webBrowser1.DocumentText = "";
}
Could someone help me?thanks in addition!