Implement OnFullscreenModeChange

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Implement OnFullscreenModeChange

Postby wrightpt » Sat Oct 01, 2016 3:30 pm

My goal is to get the browser to show fullscreen without having to hit the fullscreen button at the bottom right of the video window.


Enter url in simple_app.cc file:

Code: Select all
 if (url.empty())
    url = "https://www.youtube.com/watch?v=0DQup4hd1_o";

override the OnFullscreenModeChange method in simple_handler.h:

Code: Select all
virtual  void OnFullscreenModeChange(CefRefPtr<CefBrowser> browser, bool fullscreen) OVERRIDE;


Implement in simple_handler.cc

Code: Select all
void SimpleHandler::OnFullscreenModeChange(CefRefPtr<CefBrowser> browser, bool fullscreen) {
    // CEF_REQUIRE_UI_THREAD();
    LOG(INFO) << " OnFullscreenModeChange " << "fullscreenchanged" ;
   
    if (fullscreen != true){
   
    fullscreen = true;

    DLOG(INFO) << "fullscreen = " << fullscreen ;
   
 // return ;
      }
}


Also implemented it at the same time within this method:

Code: Select all
CefRequestHandler::ReturnValue SimpleHandler::OnBeforeResourceLoad(
      CefRefPtr<CefBrowser> browser,
      CefRefPtr<CefFrame> frame,
      CefRefPtr<CefRequest> request,
      CefRefPtr<CefRequestCallback> callback)
{

  //implemented here:
    CefDisplayHandler::OnFullscreenModeChange(browser,true);



it compiles, runs, but there is no behaviour change. Could it be how I am entering the url in the code?
wrightpt
Expert
 
Posts: 151
Joined: Wed Jun 22, 2016 11:17 am

Re: Implement OnFullscreenModeChange

Postby wrightpt » Sat Oct 01, 2016 4:16 pm

am i even close?
wrightpt
Expert
 
Posts: 151
Joined: Wed Jun 22, 2016 11:17 am

Re: Implement OnFullscreenModeChange

Postby magreenblatt » Sat Oct 01, 2016 4:34 pm

You need to implement fullscreen window changes in your application. Look at cefclient for an example.

Are you also the "JimmyH" account?
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Implement OnFullscreenModeChange

Postby wrightpt » Sat Oct 01, 2016 4:37 pm

Thank you!!!

yes, I am the JimmyH account. sorry, You can delete it. i didn't know if this was an annoying question. so i didn't want to risk my, what I feel may be an already somewhat tattered reputation. wont happen again
wrightpt
Expert
 
Posts: 151
Joined: Wed Jun 22, 2016 11:17 am

Re: Implement OnFullscreenModeChange

Postby wrightpt » Sat Oct 01, 2016 4:39 pm

Also, I do not want to change the size of the actual browser. just be fullscreen within the browser window that is already there.
wrightpt
Expert
 
Posts: 151
Joined: Wed Jun 22, 2016 11:17 am

Re: Implement OnFullscreenModeChange

Postby magreenblatt » Sat Oct 01, 2016 11:53 pm

This forum exists for asking questions. No reason to feel bad about it :)
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Implement OnFullscreenModeChange

Postby magreenblatt » Sat Oct 01, 2016 11:57 pm

wrightpt wrote:Also, I do not want to change the size of the actual browser. just be fullscreen within the browser window that is already there.

When you click the fullscreen button on an HTML5 video that video should occupy the whole window. The size of that window won't change unless your client implementation decides to change it. When you click the fullscreen button on a Flash video then you will get a full-screen window if you're not using off-screen rendering.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Implement OnFullscreenModeChange

Postby wrightpt » Sun Oct 02, 2016 4:41 pm

Still researching this.

--when I pull up a youtube video in cefclient and hit full screen, it changes the size of the entire browser to match my screen.

--but when in cefsimple, it goes fullscreen within the same window and the browser window size does not change.



I am looking to have the behaviour of cefsimple but doing it programmatically instead of with my mouse click. will propose a way to do this in my next post, still analyzing how the onfullSceen process works.

in the earlier post you mentioned "implement fullscreen window changes in your application," I do not think this will help because that is not my ultimate goal. I just want the full screen to happen upon loading and not having to click the fullscreen button with the browser window remaining the same size (not taking up the full screen of my monitor).
wrightpt
Expert
 
Posts: 151
Joined: Wed Jun 22, 2016 11:17 am

Re: Implement OnFullscreenModeChange

Postby wrightpt » Mon Oct 03, 2016 10:40 am

The below javascript function actually being called on the youtube webpage is what allows the video to go fullscreen:

Is it possible to extend CefV8Context class and use this pure virtual Eval function to execute the below function?


Code: Select all
hz=function(a){if($h())if(a.isFullscreen())bi(a.Da());else{a=a.Da();var b=Yh(["requestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen"],a);b&&b.call(a)}else a.za("onFullscreenToggled",a.isFullscreen())};
wrightpt
Expert
 
Posts: 151
Joined: Wed Jun 22, 2016 11:17 am

Re: Implement OnFullscreenModeChange

Postby magreenblatt » Mon Oct 03, 2016 10:50 am

You can execute JavaScript as described at https://bitbucket.org/chromiumembedded/ ... gration.md
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 48 guests