koca2000
koca2000

Reputation: 69

Embed Youtube video in winforms webbrowser

I am trying to embed YouTube video in C# winforms webbrowser using this code:

webBrowser_q.Navigate("https://www.youtube.com/embed/OsHFxQSOkNU?autoplay=1&controls=0&enablejsapi=1&iv_load_policy=3&rel=0&showinfo=0&showsearch=0&start=0&end=0");

Unfortunately I get only black window instead of the video.

What am I doing wrong?

EDIT: I don't want to use AS3 player, because I want to use YouTube IFrame API.

Upvotes: 0

Views: 2376

Answers (1)

Milana
Milana

Reputation: 772

You can find your answer here: C# webbrowser Ajax call

According to this answer: "WebBrowser control (both WPF and WinForms versions) behaves in many ways differently from the full IE. You may want to implement Feature Control to bring its behavior as close to IE as possible (particularly, FEATURE_BROWSER_EMULATION)."

You can see the code sample that is given there. I was able to play a youtube video while before I saw a black screen and javascript errors.

Upvotes: 1

Related Questions