5

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.

chromium;

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')
time.sleep(60)
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
user1610719
  • 103
  • 5

1 Answers1

3

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.

sibaz
  • 291
  • 2
  • 7