-3

I am using visual basic .NET. I want to embed a youtube video into my application using a url. I already tried using the Shockwave Flash Object, but youtube does not support that anymore. Is there any other way to embed youtube video into vb.net without using the Shockwave Flash Object?

BLINKOR
  • 31
  • 1
  • 9

2 Answers2

1

One method is, You can use the Webbrowser for that

public function playMyVideo()

WebBroswer1.Navigate("Your Url here")

End Function

It should work. Let me know if it works or not.

  • Try to use `Option Strict On` and you will see, where your piece of code has problems. – muffi Jan 02 '20 at 05:56
  • Yes, Webbrowser does work, although it may cause some JavaScript errors even with option Strict On – BLINKOR Sep 22 '20 at 01:00
1

for example live video for vb.net

    Dim result As String = webClient.DownloadString("https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=youtube_channel_id&eventType=live&type=video&key=your_youtube_data_v3_api_key")

    Dim html As String = "<html><head>"

    html &= "<meta content='IE=Edge' http-equiv='X-UA-Compatible'/>"

    html &= "<iframe id='video' src= '" & TextBox1.Text & "'?autoplay=1 width='" & WebBrowser1.Width & "' height='" & WebBrowser1.Height & "' frameborder='0' allowfullscreen></iframe>"

    html &= "</body></html>"

    Me.WebBrowser1.DocumentText = String.Format(html)
Emin Yalçın
  • 11
  • 1
  • 2