Introducing wpe-webkit-mir-kiosk snap


#1

Dear snapcraft community,

some have already come across this in the very lengthy [cross-post] chromium-mir-kiosk in portrait mode (rotated mir-kiosk layout) thread, but since it’s been a while, I’d like to introduce my snap wpe-webkit-mir-kiosk here and hopefully gather some feedback :blush: If you’re interested in the “why” and the bumpy road to a working snap, you can read up on the original thread. To keep things short here:

WPE WebKit Snap for Mir in kiosk mode

The WPE fork of WebKit, packaged as a snap for fullscreen use in kiosk applications.

Tested on:

  • :white_check_mark: Ubuntu Desktop 18.04.02 LTS with weston/miral-kiosk
  • :white_check_mark: Ubuntu Core with mir-kiosk on a Raspberry Pi 3

The snap should run on all snapd-supported distributions if you have a Wayland compositor running with the default socket at /run/user/0/wayland-0 (currently hardcoded, cf. this post on the snapcraft forum for details)

Features

  • Fullscreen webview for any size or rotation passed by the Wayland compositor
  • Configurable:
    • url: Accepts HTTP(S) URLs
    • devmode: Toggle Remote Inspector on/off
  • Browsing works with auto-connected interfaces
  • Ships manually connected interfaces for advanced use (Bonjour/zeroconf etc.)

Components


You can find the source at our GitLab repository. I’m currently working on pulling out the WebKit engine and its dependencies to a separate libraries snap – branch here, remaining issue described in Cmake part with build-snaps gets mangled include parameters.


Auto-connect wpe-webkit-mir-kiosk:dbus-cogctl
#2

I’ve been messing with this on my PI and it’s really cool – thanks for the hard work!

My question relates to performance. When on various web pages like youtube, it seems pretty laggy and web pages don’t seem to scroll all that smoothly. Youtube videos are also very laggy on my 1080p screen (even when playing the videos @ 480p).

This article seems to show the performance as being much better than what I’m getting on my PI, but they are using the WPE Webkit fork of build root to build a custom image.

I’m using a PI 3 B+. Is something not working (i.e. hardware acceleration) in this snap, that might be working in the WPE Webkit buildroot image? Or is all of this just a limitation of the PI’s slow processor?


#3

@tobias Would it be possible to add an arm64 build for the wpe-webkit-mir-kiosk? I was testing the armhf version and it seemed to work well, but needed to switch to arm64 due to issues with other parts of the application I’m building. snap refuses to install wpe-webkit-mir-kiosk on arm64 (Ubuntu Core).

I tried cloning the git repository and building it myself, but that was also not successful.


#4

I added arm64 to the auto-build architectures and the build went through fine. It’s currently released in latest/candidate, please give it a try and let me know it everything works :slight_smile: Then I’ll promote it to stable.

May I ask in which environment you tried to clone and build the snap? (OS, snapcraft version, builder etc.)


#5

Hi Zane, sorry for the extremely late reply! I was busy with other things again.

I haven’t really tested the snap on a Pi 3B+ yet, on a 3B it works quite ok. TBH, our application is a text-focused web app without user interaction, though we have a widget for video and it worked fine in our tests. Is your Pi connected via WiFi or Ethernet? I tested YouTube with the snap during development, but that was on an amd64 machine running Ubuntu Core, so performance is not really comparable.

The article you linked was my initial inspiration to get WPE working in a snap. If I recall correctly, the buildroot image uses the RDK backend while my snap uses the (official and most supported) FDO backend. Might be the root cause for performance disparity.

In any case, maybe I can find the time to investigate low-hanging fruits for performance improvements.


#6

@tobias Thank you! I’ll test it later today.

On my system, it is failing with the following error. OS is Ubuntu 18.04.2 LTS. Snapcraft version is 3.6. I get the same error with either SNAPCRAFT_BUILD_ENVIRONMENT=host or SNAPCRAFT_BUILD_ENVIRONMENT=multipass. The only change I made was adding architectures to the snapcraft.yaml to build on all and run on arm64.

: fatal error: wpe/webkit.h: No such file or directory

include <wpe/webkit.h>

       ^~~~~~~~~~~~~~

compilation terminated.
ninja: build stopped: subcommand failed.
Failed to run ‘cmake --build . – -j4’ for ‘cog’: Exited with code 1.
Verify that the part is using the correct parameters and try again.


#7

This sounds like the build-snap dependency wpe-webkit-libs cannot be found. I had to work around the issue in my post Cmake part with build-snaps gets mangled include parameters by manually setting WEB_ENGINE_INCLUDE_DIRS, because I couldn’t find where cmake gets those wrong include path parameters from.

I guess that when building on the host, $SNAPCRAFT_PART_INSTALL is either not set or points to the wrong directory, so cog cannot find the required libraries.

I haven’t tested native builds on the host, but in my trial runs it worked fine in a launchpass VM.


#8

Thanks for following up!

Please leave it as edge/beta channel for now. It loads fine and displays the page, but there are css issues and double-click issues. I don’t recall any css problems when I was testing on the armhf version. I think I added double-click after I did the armhf testing. Once I figure out whether the error is on my end or in wpe-webkit, I’ll let you know.


#9

Good to know! FYI: You can activate the remote inspector with snap set wpe-webkit-mir-kiosk devmode=true. When enabled, open any WebKitGTK browser (e.g. GNOME Web / Epiphany) and visit inspector://ip-or-hostname-of-your-device-running-wpe:8080.


#10

Just tested this on a Ubuntu Core 18 running on a VM and it works great! Thanks a lot for this @tobias !!