Embed Youtube video in winforms webbrowser - c#

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.

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.

Related

Is it possible to use an embbeded control in Excel to preview video feed from webcam using DirectShow?

There are a quite a few of sources to get a video stream from webcam into a picturebox embedded in a userform.
Preview a camera in DirectShow and capture a still image - in VB.net
How do i use attached webcams to take still image in my application
However, I am trying to do something a little neater, basically have a the preview of the video stream from webcam in a control that is embedded directly into the sheet rather than on a floating userform. I am not sure if this possible. I would very much appreciate any pointers.
(Answer from TnTinMn's comment - Posting as an answer to remove from 'Unanswered' queue)
If you can write a .Net WinForm UserControl to view your video stream, then you should be able to produce a ActiveX UserControl that you can utilize in Excel.
Get the Microsoft InteropForms Toolkit 2.1 .
Even though it was originally intended to allow .Net UC usage in VB6, it works fine to write UCs for use in Excel.
As a test, I just wrote one that used the Windows Media Player and it played the video fine as a UserControl on the worksheet.
Start VS as an Admin as it needs to be able to register the control.
I would say build a Form with TopMost = True
Then you can display your webcam video in this Form
and put it anywhere you want.

WPF/C# webbrowser youtube

I want to play youtube movie in my application by using webbrowser.
The problem is about autoplay movies.
I know i can use embeded, but on embeded version its impossible to navigate the website.
Is there any solution how to autoplay youtube movies?
You can use a specific control 'COM' to show a movie 'swf' in a form, called 'Shockwave Flash Object'
And Swf Url Movie:
http://www.youtube.com/v/[CODE VIDEO]&autoplay=1
Google have actually made available an API which allows you to do this kind of thing across all platforms, whether it be in a web or application interface. You can find the documentation for it here. But as a guide, here is what you can do....
All you have to do is replace parts of the URL, which can be done easily with string manipulation. I have specifed link a - which is the normal youtube link, and b - which is the API link which can play in full screen mode (or size of your frame or web browser) and many other features which you can command through the URL.
a - http://www.youtube.com/watch?v=DuLPSz_Hffw
b - http://youtube.googleapis.com/v/DuLPSz_Hffw?autoplay=1&showinfo=0&loop=1
Hope that helps!

c# with Youtube Javascript API?

I'm playing with my application which runs under .net 4 and would like to watch youtube videos there (the application is something like a MediaCenter).
I also would like to play/pause with buttons, so for my understanding I could use youtube's api for javascript?
I'm currently using Webbrowser control to show videos or is a better solution out there?
Thanks for your advises
Regards

Picture in picture video chat in WPF

I'm adding a video chat component to an existing application that will have picture in picture functionality. My questions is, due to the "airspace" problem, how can picture in picture be accomplished?
I have two activeX controls, one for the remote video feed, and one for the local video feed. They are both wrapped in their own border and I would like to show the local video and its border in the corner of the larger remote video feed. The local video renders on top of the remote video just fine (although I'm kind of confused by this because I thought that you couldn't have anything on top of an activeX controller due to airspace) but the border that contains the local video gets rendered behind everything so that you cannot see it. I've tried setting the ZIndex of the border, however, this doesn't work.
I'm just wondering how I can accomplish a form of PiP that is similar to what's used in Skype or Microsoft Lync.
EDIT: Would it be possible to simply use a popup window for the PiP? You could create the illusion that it isn't a popup pretty easily. A popup could render on top of the activeX control right?
upgrade to .net 4.5. Supposedly they solved the "airspace" problem (airspace is solved link). But, given that you are posting here I'm guessing you can't use .net 4.5?

WPF Youtube app running on Windows 7

I'm building a WPF application that should be able to play Youtube videos. But there are some problems running the app on Windows 7.
When I follow the article by Sacha Barber it shows a pop-up saying "File download security warning" which isn't very nice, I don't want the user to have to click ok every time.
Then there's a second approach. Use the WebBrowser's NavigateToString property and enter there a full HTML code for a page that plays the Youtube video. Unfortunately, that doesn't work for me at all, all I see is a black space where the video should be.
Have you ever come across anything like this? Thanks a lot.
I wrote a simple YouTube video viewer in WPF, and went down the NavigateToString route and built up the web page source by hand, using the embed code provided by YouTube, and this worked a treat (other than the fact several of the videos on YouTube are marked as unable to embed, so you get a link to view on the full site instead). I created an attached property to avoid any code behind too.
What is the code you are using?

Categories

Resources