Phil's blog

Apr 2014
Mo Tu We Th Fr Sa Su
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

WebKitGTK+ and HTML5 fullscreen video

HTML5 video is really nice and all but one annoying thing is the lack of fullscreen video specification, it is currently up to the User-Agent to allow fullscreen video display.

WebKit allows a fullscreen button in the media controls and Safari can, on user-demand only, switch a video to fullscreen and display nice controls over the video. There's also a webkit-specific DOM API that allow custom media controls to also make use of that feature, as long as it is initiated by a user gesture. Vimeo's HTML5 player uses that feature for instance.

Thanks to the efforts made by Igalia to improve the WebKit GTK+ port and its GStreamer media-player, I have been able to implement support for this fullscreen video display feature. So any application using WebKitGTK+ can now make use of it :)

The way it is done with this first implementation is that a new fullscreen gtk+ window is created and our GStreamer media-player inserts an autovideosink in the pipeline and overlays the video in the window. Some simple controls are supported, the UI is actually similar to Totem's. One improvement we could do in the future would be to allow application to override or customize that simple controls UI.

The nice thing about this is that we of course use the GstXOverlay interface and that it's implemented by the linux, windows and mac os video sinks :) So when other WebKit ports start to use our GStreamer player implementation it will be fairly easy to port the feature and allow more platforms to support fullscreen video display :)

Benjamin also suggested that we could reuse the cairo surface of our WebKit videosink and paint it in a fullscreen GdkWindow. But this should be done only when his Cairo/Pixman patches to enable hardware acceleration land.

So there is room for improvement but I believe this is a first nice step for fullscreen HTML5 video consumption from Epiphany and other WebKitGTK+-based browsers :) Thanks a lot to Gustavo, Sebastian Dröge and Martin for the code-reviews.

by Philippe Normand on Fri Aug 20 12:47:26 2010 (Viewed: 8594 / 5 comments )
  |   RSS  |   RSS2  |   Atom  |   Source  |   Edit

#.   aperez on Fri Aug 20 13:01:29 2010

This is definitely a killer feature to have in WebKitGTK+. It is very nice to see that this has landed in the code and that at some point users will be able of enjoying the feature. Congratulations!

#.   Jaroslav Smid on Fri Aug 20 18:12:29 2010

Are you sure GstXOverlay can be used on Windows? gst_x_overlay_set_xwindow_id takes gulong, that means it cannot be used on Windows without risk of HANDLE (and thus pointer) truncation - HANDLE is 64bit on 64bit Windows, but long is 32bit there ...

#.   phil on Sat Aug 21 09:24:47 2010

@Jaroslav: I am by no means windows expert but I have been using the GstXOverlay interface on a windows7 64bits VM...

But yeah maybe using a gsize instead of a gulong would be better.

#.   Jaroslav Smid on Sat Aug 21 12:00:16 2010

phil: And was your app also 64bit? Because if you run it in 32bit mode, HANDLE and long are both 32bit. Maybe bug should be reported?

#.   Jaroslav Smid on Sat Aug 21 12:13:24 2010

If you are interested:

Comments not allowed anymore on this post