Prologue and motivation
A part of my PhD. research deals with computer science as a source of innovative ways to improve education in Slovakia. My approach is mostly throwing eye-tracking at every problem and see where it sticks. The trouble with eye-tracking as a research method is, you often find yourself spending much more time changing the form of the content, rather than conducting actual experiments and getting some data out of it. While researching the readability of the study materials at our university I had to move around the paragraphs, trim out excess stuff, play with the image size and, in case of using headset-based eye-tracker apparatus, also surround the pages with chessboard markers to “ground” the generated heatmaps around the text itself. These changes made the eye-tracking possible, however they were time consuming and also may have tampered with the data to some degree.
Then the global pandemic hit and I suddenly was left without my usual guinea pigs… erm… students…, who I could abuse, forcing them to wear uncomfortable eye-tracking headgear while also having them spend much more time at school than any of them wished. I had a new task at hand – finding a way to conduct my experiments in some other manner. I started looking into webcam-based eye-trackers and found out that there are multiple interesting projects, some of them browser-based as well. Having a webcam-based solution decreases the accuracy of individual measurements, but I figured, seeing as I have much more students that have a PC with a webcam attached to it as opposed to the number of my expensive eye-tracking gear (1), I could compensate the lack of accuracy with a much greater amount of data. It’s much easier to have a hundred students read some text at home using their own devices than to have them come one at a time to school, spend 10 minutes calibrating, 10 minutes recording (the headset loses calibration after 5-10 mins) and afterwards 5 minutes disinfecting before calling in another subject. Thinking about it some more, I’ve found some additional value that could be gained by creating my own eye-tracking browser:
- I can insert eye-tracking code directly into the browser,
- I can control what web-pages students can visit, or even make a sort of “playlist” of pages that will be shown to them,
- I can enable Adobe Flash Player to display some legacy educational animations that we didn’t rewrite in a modern way yet….
This last point is the one I finally successfully solved and I write this post still riding on the high of this feat of overcoming frustration
The heroic struggle of an idiot with a search engine…
At first, I thought this would be the easiest task (scarily enough, it may yet prove to be). I would just check the documentation and it should be easy-peasy, right?
The problem doesn’t lie in the fact, that flash is deprecated, won’t be shipped starting January 2021 and most browser need to be forced at a gunpoint to run it (and even than will complain and try to make you disable it asap). The problem lies in that the otherwise good Qt documentation lies to you.
This is what qtwebengine page in the docs say:
What it fucking doesn’t tell you (and neither does any of the numerous forum posts) is, that this isn’t enough. What happens when you only do this is:
Fortunately, some other sucker has been trying to do something similarly stupid as I am, and I’ve found this StackOverflow post, that pointed me towards this forum post. Unfortunately it’s been written in the old pre-QML era, but I was able, after a brief “try and error” figure out, that I need to add this to my QML WebEngineView, in order to enable plugins in my homemade browser.
Then I tried downloading Adobe Flash Player and placing it directly in my home folder and explicitly give my app the path. Done?
I tried many more stupid things – compiling qtwebengine from source, switch between 32bit and 64bit versions, even trying it in Windows to no avail. At long last, I tried running my app from bash, instead of QtCreator and I got a nice little error message:
Operation not permitted? I didn’t just copy the system version of flash, I downloaded an archive from Adobe site and extracted it. It should have proper permissions… just to be sure, I’ve ‘chmod 777’ it and the permissions checked again:
Nope… same thing. I got really frustrated. Enough to do something really silly – running it with sudo:
Finally an useful piece of information! I truly never heard of QWebEngine being inside any sandbox. It does make sense, seeing as it’s really just Chromium, but one would think that this silly little detail might be mentioned in any example or documentation, right? NOOOOO! Anyways, I’ve added –no-sandbox to my parameters and now it WORKS!
So what is the magic formula after all?
./EyeBrowser --enable-pepper-testing --ppapi-flash-path=~/libpepflashplayer.so --no-sandbox
Afterwards, when I finally found out what was the issue, I decided to search the documentation for the –no-sandbox option, just to make sure I’m not a total idiot. Of course, there has been a mention of the sandbox feature in the docs, however it was never mentioned that it would interfere with the plugins. In my endless stupidity, I thought it would only limit the reach plugins and the websites had on my system and not preventing me from even launching the plugin itself.
I’m tired and going to sleep… Screw this shit.