I've got a Pi with a Adafruit TFT LCD installed.

I'm using omxplayer and fbcp to stream videos at startup using python, like so:

# Start Loop
ct = 1
video_list = glob.glob('videos/*')
os.system('fbcp &')
while ct < 300:
    ct += 1
    for val in video_list[::-1]:
        os.system('omxplayer "%s"' % val)
os.system('sudo killall fbcp')

Now I can get video to show up directly on the LCD.

I'm also wanting to throw a browser window into my loop. I understand how to do so pythonically, but cannot get a browser window to pop up on the fb1. I've tried multiple browsers with no luck.


pi@raspberrypi ~ $ chromium --kiosk --start-maximized www.google.com

(chromium:2786): Gtk-WARNING **: cannot open display:

I've tried others, but that was my latest attempt. Anything I've googled I've not got good answers for, because I think most everyone is trying to output these browsers after startx, and they don't want to be able to control them after.

I want to be able to do a loop in Python to switch between browser and omxplayer, something like below:

os.system('chromium --kiosk --start-maximized www.google.com')
os.system('exit chromium') # Or whatever the exit command is, I can find that
#Now do omxplayer video loop
os.system('omxplayer %s' % val)
#Exit omxplayer, restart browser
#Restart omxplayer
  • For the line os.system('exit chromium') # Or whatever the exit command is, I can find that you may like to try: os.system('kill `ps -C chromium -o pid=`') - the output from the (inner) OS command ps -C chromium -o pid= is a number that is included in the outer OS command kill <pid> which, in the absence of an extra (explicit) signal type as a -SIGNAL name or number argument, will send a SIGTERM to the given process, telling it to end politely... Note the inner command is quoted with backquotes which are necessary for this to work (they say "use the output from this command"). – SlySven Jan 6 '16 at 23:04
  • Thank you! Yea I've seen that before, I'm not worried about killing chromium but that's always a good option if it doesn't have a kill! I'm mainly worried about getting a browser to show up on this page! – user1610719 Jan 6 '16 at 23:10
  • Also +1 for the word pythonically ! 8-) – SlySven Jan 17 '16 at 18:18
  • Is there no "kiosk" X desktop mode available? Like Windows has a kiosk option where the PC starts to a blank desktop and then executes your custom program, which then does things (like your Python software, but I usually used .NET application to start). There should be a way to do this on a Pi? That way you have the graphics initialised and you can write your software to do graphical things on screen. – Piotr Kula Jan 18 '16 at 15:24

I may be misunderstanding what you're trying to do, but I think you're trying to use the wrong tools for the job. So I assume what you're trying to do, is ultimately show an application screen (the browser) on a frame buffer, without conceptually making that frame buffer into a regular X screen.

So conceptually you have 2 options. First option, find a non-X application, that uses a framebuffer (like mplayer), which can do web browsing, whilst passing the control to a controlling app. Second option, create an X system, that has your fb as it's graphical output, whilst you trap the controls, and keep them in your outer app.

In your example, you've used chromium, well I very much doubt you'll be able to use that out of the box, in the first setup. It's an X app, and the error you're getting is because it's expecting to connect to an X server. The second setup above, would present an X server and so would work.

So if you want to follow the first option, you'll need to find/make a non X, browser. It's my understanding that gheko(?) is a library that essentially does html rendering, without tying that conceptually to an application. I suspect you could use that to make a web browser that you could control, but which you could have use svga/framebuffer type rendering rather than using X, but you will need to code some C++. It'd be much easier if you could find a browser that'd do it for you. You may be able to run some kind of browser headless and periodically take screenshots, but it sounds like you're simply using the wrong tools for the job. I did a quick search and found http://www.netsurf-browser.org/about/ which claims to be a framebuffer browser, so it might work for you.

If you want to follow the second option, I'm sure you'll be able to find examples to get a generic framebuffer device up and running as your X display device, then you just need to get a handle on the various keyboard events inside X run up X without any input devices, and setup your controlling app as something that can put said events into the browser app, like a window manager. This approach is probably easier, but will still involve some coding.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.