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?
Asked
Active
Viewed 1,647 times
-3
-
1https://freevideolectures.com/course/3490/visual-basic-net/27 – Robert Harvey Jan 02 '20 at 00:23
-
3https://stackoverflow.com/q/49047715/102937 – Robert Harvey Jan 02 '20 at 00:24
-
1https://hindi.webdunia.com/education-video/x2g14u1 – Robert Harvey Jan 02 '20 at 00:25
-
YouTube doesn't support JavaScript Embedded videos anymore so Shockwave doesn't work. – BLINKOR Jan 08 '20 at 22:54
2 Answers
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