I have a c++ project with 2 WeBBrowser
in a TableLayoutPanel
they are set side by side, it's working fine I navigate normal but when I go to specific websites and play a video in fullscreen that sets my whole monitor to fullscreen instead of setting only the WeBBrowser
itself, however on other websites that fits perfect in the WeBBrowser
. Is there a way to change the way it displays fullscreen? I wanna make it display fullscreen in the WeBBrowser
only. I think it has something to do with WebBrowserBase.ActiveXInstance
Property or WebBrowser.Document
Property. Most examples I find on the internet is for the old VB and not related to the fullscreen property.
Here's a similar question: WebBrowser control video element enter fullscreen
In other examples I've seen a method to extract the element by doing:
HtmlElement^ object = webBrowser1->Document->GetElementById("video");
But I have no idea how to handle that code in order to format that video then set it back to the WeBBrowser
with fullscreen mode fixed.
EDIT:
I went further and I could get the <video>
element just from a few websites, here's my method:
private: System::Void webBrowser1_DocumentCompleted(System::Object^ sender, System::Windows::Forms::WebBrowserDocumentCompletedEventArgs^ e) {
HtmlElementCollection^ videoElements = webBrowser1->Document->GetElementsByTagName("video");
videoElements[0]->SetAttribute("style", "width: 640px; height: 480px;"); //Not sure if this is a proper way to set an attribute in this element.
}
The problem is that not every website gives you access to <video>
tag elements, so for those websites I did the following code to make sure there were indeed no <video>
tag elements in the source:
System::Diagnostics::Debug::Write(webBrowser1->DocumentText);
Then I didn't find any <video>
tag element in the output, only a few websites provide me that. Why? How to really get and manipulate properly <video>
tag elements in c++?