GithubHelp home page GithubHelp logo

balena-io-experimental / browser Goto Github PK

View Code? Open in Web Editor NEW
95.0 8.0 70.0 1.05 MB

A drop-in web browser block

Shell 33.28% CSS 1.55% HTML 12.90% JavaScript 52.28%
chromium browser balenablock raspberrypi3 raspberrypi3-64 raspberrypi4-64 jetson-nano intel-nuc generic-aarch64 fincm3

browser's Issues

No Audio

Is this project supposed to have HDMI output audio?

Running on a raspberry pi4, with a microHDMI -> HDMI cable running to a display with internal speakers, I cannot get audio to function.

I see we usermod chromium into the audio group, would there be more to do to support HDMI audio out?

Support screensaver / power-save mode

It'd be nice if there were a config option to set an idle timer so the screen powers down if there's no user interaction for a certain amount of time.

Video playback tearing (RPI4)

Hi,
I testet a lot for Raspberry Pi 4 to get Video Playback with chrome. All the samples have the problem of tearing. What works is WebGL 2.0 so there is some kind of accelerated video support.
An Example for the tearing looks like this:
PXL_20201207_221327461 MP

Latest image from Docker registry contains v1 code

I try to use this balenablock as described in readme.md (docker-compose file), but on the Balena device (Raspberry Pi 4), the image I get from Docker registry (balenablocks/browser:latest, same as balenablocks/browser:raspberrypi4-64) does not contain current v2.0.1 code (https://github.com/balenablocks/browser/tree/v2.0.1), but v1.0.1 code (https://github.com/balenablocks/browser/tree/v1.0.1).

To finish with an idea, perhaps automated pushing of docker images from continuous delivery would allow easier review from the community and prevent such errors. I don't know if it is possible in Balena ecosystem.

Multiscreen Browser

Hi everyone,

Does anyone know if it is possible to launch multiple instances of the browser block? I mean, my ultimate goal is to use a single device with two screens attached to launch two different URLs (each screen displays a different URL).

Many Thanks

Rotating screens causes detected resolution issues

Users currently have to use the ROTATE_DISPLAY and WINDOW_SIZE enVars to get a screen rotated and viewed correctly. Look into whether we can swap the values of the detected resolution, to do this for the user when they set the ROTATE variable:

Example:

  • detected resolution = 1920,1080
  • rotate setting = left
  • applied resolution = 1080,1920

Pass all environment variables from the main process into the `su` command

Currently the su command uses the whitelist option to pass in chromium configuration environment variables. However, this doesn't pass in other variables, for instance tz where a user is overriding the timezone. Instead of keep adding to the whitelist manually, we should pass in all the enVars from the main process into the su command, to catch them all.

Browser block does not run on rpi4

Just a basic push and it does not come up

[Logs] [9/4/2021, 8:38:29 AM] Service exited 'browser sha256:fa7ca3bc2ac4314d5f68595bb8cb219c1b9259cffa39ae6f4617f1024543104c'
[Logs] [9/4/2021, 8:39:21 AM] Restarting service 'browser sha256:fa7ca3bc2ac4314d5f68595bb8cb219c1b9259cffa39ae6f4617f1024543104c'
[Logs] [9/4/2021, 8:39:22 AM] [browser] Running balena base image entrypoint...
[Logs] [9/4/2021, 8:39:22 AM] [browser] setting xserver-xorg-legacy/xwrapper/allowed_users from configuration file
[Logs] [9/4/2021, 8:39:27 AM] [browser] Using default chromium flags
[Logs] [9/4/2021, 8:39:27 AM] [browser] Enabling GPU acceleration
[Logs] [9/4/2021, 8:39:27 AM] [browser] Custom window size set to 800,600
[Logs] [9/4/2021, 8:39:27 AM] [browser] Using default window position
[Logs] [9/4/2021, 8:39:27 AM] [browser] Enabling kiosk mode
[Logs] [9/4/2021, 8:39:27 AM] [browser] Enabling cursor
[Logs] [9/4/2021, 8:39:31 AM] Service exited 'browser sha256:fa7ca3bc2ac4314d5f68595bb8cb219c1b9259cffa39ae6f4617f1024543104c'
[Logs] [9/4/2021, 8:40:32 AM] Restarting service 'browser sha256:fa7ca3bc2ac4314d5f68595bb8cb219c1b9259cffa39ae6f4617f1024543104c'
[Logs] [9/4/2021, 8:40:32 AM] [browser] Running balena base image entrypoint...
[Logs] [9/4/2021, 8:40:33 AM] [browser] setting xserver-xorg-legacy/xwrapper/allowed_users from configuration file
[Logs] [9/4/2021, 8:40:34 AM] [browser] Using default chromium flags
[Logs] [9/4/2021, 8:40:34 AM] [browser] Enabling GPU acceleration
[Logs] [9/4/2021, 8:40:34 AM] [browser] Custom window size set to 800,600
[Logs] [9/4/2021, 8:40:34 AM] [browser] Using default window position
[Logs] [9/4/2021, 8:40:34 AM] [browser] Enabling kiosk mode
[Logs] [9/4/2021, 8:40:34 AM] [browser] Enabling cursor
[Logs] [9/4/2021, 8:40:38 AM] Service exited 'browser sha256:fa7ca3bc2ac4314d5f68595bb8cb219c1b9259cffa39ae6f4617f1024543104c'

We shouldn't overwrite the KIOSK Flag

https://github.com/balenablocks/browser/blob/2739c0f00933116d5e4eff4ee453dbd067702d1f/start.sh#L86

If we overwrite the KIOSK flag, it is not as easy to detect if KIOSK mode is enabled when we use the browser block in other projects.

Also, It doesn't seem we are using the exported KIOSK values in the flags when launching chromium.
https://github.com/balenablocks/browser/blob/2739c0f00933116d5e4eff4ee453dbd067702d1f/start.sh#L115

Is https://github.com/balenablocks/browser/blob/2739c0f00933116d5e4eff4ee453dbd067702d1f/start.sh#L88

only necessary?

ROTATE_DISPLAY not working

Hey guys!

I have a really simple setup:

Fin CM3 4GB
Official RPi 7" display

docker-compose.yml

version: '2'

services:
  browser:
    image: balenablocks/browser:raspberrypi4-64
    privileged: true
    network_mode: host
    volumes:
      - 'settings:/data'
    restart: unless-stopped
    environment:
      - KIOSK=1
      - PERSISTENT=1
      - ROTATE_DISPLAY=inverted
      - LAUNCH_URL=http://google.com

volumes:
  settings:

However, the display is always in the normal mode.
I've tried playing around with different settings from balenaDash and balenaBrowser but no luck so far.

If I have to switch to the cloud to configure it, that's fine, but I'm in local mode right now.

Thanks for any help.
Paul

Browser block does not work in local mode

I created a very simple server that serves a static mp4 file, and whenever the browser tries to read it it crashes with:

[Logs]    [9/4/2020, 2:51:07 PM] [browser] hostname: No address associated with hostname
[Logs]    [9/4/2020, 2:51:07 PM] [browser] xauth:  file /home/chromium/.Xauthority does not exist
[Logs]    [9/4/2020, 2:51:07 PM] [browser] xauth: (stdin):1:  bad display name "aff8c20:0" in "add" command
[Logs]    [9/4/2020, 2:51:07 PM] [browser] 
[Logs]    [9/4/2020, 2:51:07 PM] [browser] 
[Logs]    [9/4/2020, 2:51:07 PM] [browser] X.Org X Server 1.20.4
[Logs]    [9/4/2020, 2:51:07 PM] [browser] X Protocol Version 11, Revision 0
[Logs]    [9/4/2020, 2:51:07 PM] [browser] Build Operating System: Linux 4.15.0-99-generic armv8l Raspbian
[Logs]    [9/4/2020, 2:51:07 PM] [browser] Current Operating System: Linux aff8c20 4.19.75 #1 SMP Thu Jun 4 14:39:26 UTC 2020 armv7l
[Logs]    [9/4/2020, 2:51:07 PM] [browser] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 bcm2708_fb.fbwidth=1184 bcm2708_fb.fbheight=624 bcm2708_fb.fbswap=1 smsc95xx.macaddr=B8:27:EB:AB:E2:34 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 console=tty1 console=ttyS0,115200 rootfstype=ext4 rootwait root=UUID=ba1eadef-cae9-446c-a81f-1a39b4c52dab rootwait
[Logs]    [9/4/2020, 2:51:07 PM] [browser] Build Date: 07 July 2020  09:38:51PM
[Logs]    [9/4/2020, 2:51:07 PM] [browser] xorg-server 2:1.20.4-1+rpt2 (https://www.debian.org/support) 
[Logs]    [9/4/2020, 2:51:07 PM] [browser] Current version of pixman: 0.36.0
[Logs]    [9/4/2020, 2:51:07 PM] [browser] 	Before reporting problems, check http://wiki.x.org
[Logs]    [9/4/2020, 2:51:07 PM] [browser] 	to make sure that you have the latest version.
[Logs]    [9/4/2020, 2:51:07 PM] [browser] Markers: (--) probed, (**) from config file, (==) default setting,
[Logs]    [9/4/2020, 2:51:07 PM] [browser] 	(++) from command line, (!!) notice, (II) informational,
[Logs]    [9/4/2020, 2:51:07 PM] [browser] 	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[Logs]    [9/4/2020, 2:51:07 PM] [browser] (==) Log file: "/var/log/Xorg.0.log", Time: Fri Sep  4 12:51:07 2020
[Logs]    [9/4/2020, 2:51:07 PM] [browser] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[Logs]    [9/4/2020, 2:51:08 PM] [browser]  --disable-quic --enable-tcp-fast-open --ppapi-flash-path=/usr/lib/chromium-browser/libpepflashplayer.so --ppapi-flash-args=enable_stagevideo_auto=0 --ppapi-flash-version=
[Logs]    [9/4/2020, 2:51:10 PM] [browser] [114:154:0904/125110.806190:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[Logs]    [9/4/2020, 2:51:11 PM] [browser] libEGL warning: DRI2: failed to authenticate
[Logs]    [9/4/2020, 2:51:11 PM] [browser] [114:345:0904/125111.585364:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[Logs]    [9/4/2020, 2:51:11 PM] [browser] [114:345:0904/125111.673111:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[Logs]    [9/4/2020, 2:51:11 PM] [browser] [114:345:0904/125111.673679:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[Logs]    [9/4/2020, 2:51:12 PM] [browser] [114:368:0904/125112.036430:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[Logs]    [9/4/2020, 2:51:12 PM] [browser] [114:368:0904/125112.037712:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[Logs]    [9/4/2020, 2:51:12 PM] [browser] [114:368:0904/125112.038577:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[Logs]    [9/4/2020, 2:51:12 PM] [browser] [114:368:0904/125112.040527:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[Logs]    [9/4/2020, 2:51:12 PM] [browser] [114:368:0904/125112.041620:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[Logs]    [9/4/2020, 2:51:12 PM] [browser] [163:163:0904/125112.345495:ERROR:sandbox_linux.cc(369)] InitializeSandbox() called with multiple threads in process gpu-process.
[Logs]    [9/4/2020, 2:51:12 PM] [browser] 
[Logs]    [9/4/2020, 2:51:12 PM] [browser] (chromium-browser-v7:114): Gtk-WARNING **: 12:51:12.793: Could not load a pixbuf from icon theme.
[Logs]    [9/4/2020, 2:51:12 PM] [browser] This may indicate that pixbuf loaders or the mime database could not be found.
[Logs]    [9/4/2020, 2:51:12 PM] [browser] 
[Logs]    [9/4/2020, 2:51:12 PM] [browser] (chromium-browser-v7:114): GdkPixbuf-CRITICAL **: 12:51:12.794: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
[Logs]    [9/4/2020, 2:51:12 PM] [browser] 
[Logs]    [9/4/2020, 2:51:12 PM] [browser] (chromium-browser-v7:114): GdkPixbuf-CRITICAL **: 12:51:12.795: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
[Logs]    [9/4/2020, 2:51:12 PM] [browser] 
[Logs]    [9/4/2020, 2:51:12 PM] [browser] (chromium-browser-v7:114): GdkPixbuf-CRITICAL **: 12:51:12.800: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
[Logs]    [9/4/2020, 2:51:12 PM] [browser] (chromium-browser-v7:114): GdkPixbuf-CRITICAL **: 12:51:12.800: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
[Logs]    [9/4/2020, 2:51:12 PM] [browser] 
[Logs]    [9/4/2020, 2:51:12 PM] [browser] (chromium-browser-v7:114): GdkPixbuf-CRITICAL **: 12:51:12.804: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
[Logs]    [9/4/2020, 2:51:12 PM] [browser] 
[Logs]    [9/4/2020, 2:51:12 PM] [browser] (chromium-browser-v7:114): GdkPixbuf-CRITICAL **: 12:51:12.804: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
[Logs]    [9/4/2020, 2:51:13 PM] [browser] usrvcsm: [vcsm_malloc_cache]: [163] [ChromeBuf]: ioctl mem-alloc FAILED [-1] (hdl: 0)

See this repo: https://github.com/balena-io-playground/steve-play-with-blocks
I was doing localpush to an rpi3 device.

Keep command-line option for persistence seperate from FLAGS

https://github.com/balenablocks/browser/blob/a53ab4ce87d08a0ba14eb51a1d7f6640a8618d3e/start.sh#L71

Someone trying to keep persistence working but only modifying some other flags might have to remember to add the above option to the flags?

maybe we export PERSISTENT_FLAG="--user-data-dir=/data" if we detect the variable then do
echo "chromium-browser $CHROME_LAUNCH_URL $FLAGS $PERSISTENT_FLAG --window-size=$WINDOW_SIZE --window-position=$WINDOW_POSITION $OUTPUT" >> /home/chromium/xstart.sh here
https://github.com/balenablocks/browser/blob/a53ab4ce87d08a0ba14eb51a1d7f6640a8618d3e/start.sh#L150

ROTATE_DISPLAY does not work on RPi 4

The current version of the browser block does not rotate the display on the RPi 4 with the current settings / vc4-fkms-v3d.
If you decide to rotate, it will just resize the window - starting on 0,0 and then not e.g. landscape it like normal, but resize it in portrait if you ROTATE_DISPLAY=right - but not rotate the display/screen.
The only reliable way i found was to leave the ROTATE_DISPLAY and WINDOW_SIZE settings all alone and rotate the screen itself on boot by using BALENA_HOST_CONFIG_display_hdmi_rotate=3 (for 270 degree clockwise rotation). Then it will work flawlessly.

Chrome doesn't use the full screen width

Similar to what's mentioned in the readme https://github.com/balenablocks/browser/tree/4676a0230886b68afd613992a2039ee141423dc6#partial-display-output I'm experiencing chrome not using the whole screen. I noticed the following in the log:

30.03.21 19:00:26 (+0800)  kiosk  Running balena base image entrypoint...
30.03.21 19:00:27 (+0800)  kiosk  setting xserver-xorg-legacy/xwrapper/allowed_users from configuration file
30.03.21 19:00:27 (+0800)  kiosk  Using default chromium flags
30.03.21 19:00:27 (+0800)  kiosk  Enabling GPU acceleration
30.03.21 19:00:27 (+0800)  kiosk  Adding user settings directory
30.03.21 19:00:27 (+0800)  kiosk  Custom window size set to 
30.03.21 19:00:27 (+0800)  kiosk  Enabling kiosk mode
30.03.21 19:00:27 (+0800)  kiosk  Enabling cursor

Note the "Custom window size set to". This indicates that in the following code

https://github.com/balenablocks/browser/blob/4676a0230886b68afd613992a2039ee141423dc6/start.sh#L86-L93

the if doesn't take the right branch, even though I haven't configured a device service variable WINDOW_SIZE.

I'm hesitant to conclude that the particular if syntax doesn't do what it's supposed to do, given that it's used in that form in so many other places in https://github.com/balenablocks/browser/blob/4676a0230886b68afd613992a2039ee141423dc6/start.sh .

I observed that there's a device variable by the name WINDOW_SIZE in the balena dashboard. Maybe that interferes?

Suppress Error Messages Created by Killing Service

Thank you for this seed project. I have two mild bugs and/or suggestions:

In many kiosk instructions, there will be the following mild hack

sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' /home/pi/.config/chromium/Default/Preferences
sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' /home/pi/.config/chromium/Default/Preferences

so that when you deploy again you won't get an offer to "restore tabs". I'd also suggest

--noerrdialogs \
--disable-infobars \

to gain even more real estate in "kiosk" mode.

Version 2.0.3 not working for pi400

11.05.21 10:00:36 (+0000)  browser  Fatal server error:
11.05.21 10:00:36 (+0000)  browser  (EE) no screens found(EE) 
11.05.21 10:00:36 (+0000)  browser  (EE) 
11.05.21 10:00:36 (+0000)  browser  Please consult the The X.Org Foundation support 
11.05.21 10:00:36 (+0000)  browser       at http://wiki.x.org
11.05.21 10:00:36 (+0000)  browser   for help. 
11.05.21 10:00:36 (+0000)  browser  (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
11.05.21 10:00:36 (+0000)  browser  (EE) 
11.05.21 10:00:36 (+0000)  browser  (EE) Server terminated with error (1). Closing log file.

Rotate touch input with display

When ROTATE_DISPLAY is set the output is rotated but input events from a touchscreen are not.
The touchscreen I'm using is the 11.6inch Waveshare FHD screen with touch attached via USB.

Add default flag value for window-position

The chromium browser shows a black border in the top and left sides of the screen by default. In order to utilize the full real estate of the screen, one has to add an environment variable FLAGS with a value of --window-position=0,0.

This should be the default value for this flag.

Browser needs to reconnect to local server if the local server container restarts

I found it pretty handy that the browser tries to look for a local service running on port 80, but the functionality is pretty limited. This can still be an opt-in functionality, but what is more practical is if the server itself announces to the browser what endpoint to hit and when, which should give the control for retries, failure handling, etc. to the other services.

I was developing a couple of services locally and using livepush the server would restart, and the browser wouldn't show an empty page and it wouldn't try to reconnect to the server. I can imagine the same thing happening in production and the only way to recover will be to restart the browser service.

Web browsing is slow on RPI4-4GB

The Web Browsing is slow on RPI4 with 4GB ram. I compared it with raspian native installed. Are there any settings in balena?
Same situation when GPU enabled, doesnt matter if enabled or disabled.
thx for your help

Chromium Remote Debugging

Has anyone gotten chromium remote debugging to work? I haven't had any luck.

I'm using an rpi3 device
The port debug is open and exposed publicly on the device:
image
I can successfully connect to the other container on 8080.

Not sure what else I could be missing.

Make pre-installed extensions configurable

Now two Chromium extensions are preinstalled using the policy.json file:

I'm having problem with the second one.
At this moment it's indirectly blocking any communication with sentry.io API - which I use for error reporting.
Using error reporting tool is very important for me as some of the issues are unique for Chromium running on low CPU devices.

While for my use case it would be enough to omit the Adblock Plus extension, I imagine that other developers could benefit from option to add other extensions to the list.

All browser window can't be seen

IMG_2334
Hey All,
I am using this block as a service on my Raspberry Pi 4 to get display from a custom url. However, I always get top left corner part of the website. Even when I try to change WINDOW_SIZE at start.sh bash file, that only makes the display bigger but, still get only a part of the site.
Is there any other configuration that I miss?

RESULT_CODE_MISSING_DATA errors

Is anyone else getting RESULT_CODE_MISSING_DATA errors?
I'm seeing the error occur sporadically on my fleet of rpi3b+ devices running 32 bit Balena OS. Restarting the service resolves the issue, until the next random occurrence. An individual device can go weeks between errors, but even with a smallish fleet it quickly becomes a support headache.

Time Zone Implementation

Hey All,

So I noticed that this block does not have the capability for the user to set the time zone. And for a browser, I feel like this is a key need, so I figured I would bring it up.

I will try my hardest to start looking into ways to get this implemented, but I am fairly new to this arena so I figured I would reach out and see if anyone with a bit more experience would be able to get a PR together sooner, and then I could learn that way also.

Anyways, suggestions would be appreciated too. Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.