Really Fast Browser Inside! (mp4 video & mp3 audio support)


47 posts   Page 2 of 2   1, 2
by Gomoto » Sat Mar 16, 2013 12:03 pm
Release Candidate for version 1.0-6 available for testing.

new features:
* login only once to your favourite sites (persistent cookies now supported)
* flawless playback of high quality video streams on selected sites (Use q to quit if streaming rate is too low, no lockups)
(Test video playback on german news site: www.tagesschau.de)

additional options:
* youtube streams detected (Add your own youtubestream.sh shell script and start to watch youtube videos)

Downloads available here:
http://code.google.com/p/minimal-web-browser/

Install Instructions for Testing:
sudo dpkg -i omxgtk_0.1_rc1_armhf.deb
sudo dpkg -i web_1.0-6_rc1_armhf.deb
Posts: 106
Joined: Tue Feb 12, 2013 1:21 am
by gkreidl » Sat Mar 16, 2013 2:12 pm
I have modified your former version (and will merge the two soon).

Changes in my version:
added python scripts to play video and audio and m3u playlist files with omxplayer and to open pdf files in either mupdf or xpdf.

I did'nt use omxgtk yet.

What I'm still missing is a zoom function. Some web pages are simply too small on a 1920x1080 screen.

Guenter
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer
Posts: 5025
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by rebb » Sat Mar 16, 2013 5:36 pm
Any example or guide how to cook youtubestream.sh?
Posts: 12
Joined: Wed Jan 09, 2013 10:24 am
Location: Finland
by Gomoto » Sat Mar 16, 2013 9:55 pm
first you would probably have to download an ominous program called youtube-dl

then a lot of lines of code would be needed,
that is exactly four (ok could be done in one)
and call them youtubestream.sh

Code: Select all
#/bin/bash
rm /tmp/mystdin
mkfifo /tmp/mystdin
youtube-dl -f 18 "$@" -o /tmp/mystdin | omxgtk /tmp/mystdin


(If this would not work anymore, you would have to issue a youtube-dl -U to update)

But you would also have to decide yourself, wether this is ok in the place you are living.
Posts: 106
Joined: Tue Feb 12, 2013 1:21 am
by Gomoto » Sat Mar 16, 2013 11:07 pm
@Guenter
zoom and key support added to source
Posts: 106
Joined: Tue Feb 12, 2013 1:21 am
by rebb » Sun Mar 17, 2013 6:27 pm
Ok copied your script, chmodded it with 777 and it does not anymore give error about missing youtubestream.sh in console when accessing youtube.

Yt-download is uptodate, and with whitey youtube is working fine. Still no luck in browser, it does not give any errors in console just does not start playing.
Posts: 12
Joined: Wed Jan 09, 2013 10:24 am
Location: Finland
by Gomoto » Sun Mar 17, 2013 8:22 pm
seems google/youtube changed today from http to https
you can check if the script is working:
youtubestream.sh url
(I have to update the browser detection)

Edit:
rc2 with updated detection and zoom (ctrl + / ctrl -) available
Posts: 106
Joined: Tue Feb 12, 2013 1:21 am
by rebb » Mon Mar 18, 2013 12:18 am
Now works like a charm. New version and firmware update did the trick.
People with hdmi sound might want to edit /usr/bin/omxgtkplayer line
OMXPLAYER_BIN="/usr/bin/omxplayer.bin"
to
OMXPLAYER_BIN="/usr/bin/omxplayer.bin -ohdmi"
Posts: 12
Joined: Wed Jan 09, 2013 10:24 am
Location: Finland
by gkreidl » Tue Mar 19, 2013 11:36 am
The zoom function only works on text elements now and web pages become distorted that way. To enable full zoom on everything you have to add:

webkit_web_view_set_full_content_zoom(webView,TRUE);

in activateEntry, just before loading the uri.

Also the zoom steps of 25% are a bit crude. Perhaps you should change them to the default value of 0.1.

I have also added:
g_object_set (G_OBJECT(settings), "enable-universal-access-from-file-uris", TRUE,NULL);
to allow loading local html pages. A user could choose such a local html page as his home page, for example with links to his favourite site or servers.

What do you think of adding a full screen view, just like you did in omxgtk?

Guenter
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer
Posts: 5025
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by Gomoto » Tue Mar 19, 2013 9:11 pm
Yes I prefer full content zoom, steps .1 and local file access as well.
source updated
(For bookmarks I am using the openbox menu, only using three sites standard, news and raspberry :-). All other sites, I prefer to google them and not clutter my minimalist interface)

I am not sure about the fullscreen option.
Posts: 106
Joined: Tue Feb 12, 2013 1:21 am
by gkreidl » Wed Mar 20, 2013 12:11 am
Thanks, Gomoto.

I have lots of downloaded websites on my network drives and also ebooks in html format, so loading local html files is an important option for me.

I'm not asking for a bookmarks function inside web (keep it simple!), but if I can load local html files I can create my own start page with links to my fav. sites or my local servers. That's why I added local files (adresses like "file://..."). It just requires two small changes in the code. In fact, I'm using a simple local file for the home function now, which contains links to my local servers (a media server, a tv server and more) and a few websites.

I'm mostly using web in "kiosk mode", without starting the desktop. Besides web I'm running a media server on the raspi to access all kind of media files.

Guenter
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer
Posts: 5025
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by gkreidl » Fri Mar 22, 2013 3:49 pm
@Gomoto

I've modified the source to some degree to fit my needs. Some of this may be only important for myself, but two changes might be interesting for your main line of development.

1) in navigationPolicyDecision:

Code: Select all
if (webkit_web_frame_get_parent(frame) == NULL) {
        gtk_entry_set_text(entry, webkit_network_request_get_uri(request)); }

The current version always puts the uri of the frame loaded last into the entry line (if the page contains frames or iframes). With this modification you always get the main url.

2) I have rewritten activateEntry so that it works more like in usual browsers. You only used to set "http://" in front, if an uri starts with "www.", but that is rather obsolete now. My solution is a bit different:
if the entry line starts with "?", search the rest of the linne with google;
if the entry line starts with "/", search for the text within the loaded website (as before);
if the entry line starts with "http" or "file", try to load it, as it is;
in all othert cases: put "http://" in front.
Here#s the code:
Code: Select all
static void activateEntry(GtkWidget* entry, gpointer* gdata)
{
        WebKitWebView* webView = g_object_get_data(G_OBJECT(entry), "webView");
        const gchar* entry_str = gtk_entry_get_text(GTK_ENTRY(entry));
        const gchar* search_str = "http://www.google.com/search?as_q=";
        /* search on Google if prefix ? */
        if (strncmp(entry_str , "?", 1) == 0 ){
                gchar* s = g_strdup(entry_str);
                s++; // remove prefix
                gtk_entry_set_text(GTK_ENTRY(entry),
                                   g_strjoin(NULL, s, entry_str, NULL));
        /* search text on page if prefix / */
        } else if (strncmp(entry_str, "/", 1) == 0 ){
                gchar* s = g_strdup(entry_str);
                s++; // remove prefix
                searchText(webView, s);
                return;
        /* put http:// in front */
        } else if ((strncmp( entry_str, "http", 4) != 0 ) && (strncmp( entry_str, "file", 4) != 0 )) {
                gtk_entry_set_text(GTK_ENTRY(entry), 
                                    g_strjoin(NULL, "http://", entry_str, NULL));
        }
        const gchar* uri = gtk_entry_get_text(GTK_ENTRY(entry));
        webkit_web_view_load_uri(webView, uri);
   gtk_widget_grab_focus( GTK_WIDGET(webView));
}

I've noticed, that you have included support for pdf files in your recent code. This will do for most purposes, but won't work on links with options at the end of the uri: ...pdf#page=167&zoom=100,0,0 Such uris will open a pdf file on page 167 and set the zoom to 100% in Acrobat plugin or in the pdf viewer of chrome. Setting the zoom is not possible with mupdf or xpdf, but both support a page parameter. My solution is a bit more refined, but it requires a python script "openpdf.py". It will check, if the pdf file has already been downloaded (for repeated requests of the same document) or if it is coming from a "file://" link and open it directly in either case; otherwise it will download file and open it afterwards with either xpdf (if installed) or mupdf and also forward the page directive if it is contained in the link:

Code: Select all
#!/usr/bin/env python

import os,urllib,sys
if os.path.exists('/usr/bin/xpdf'):
    pdfprogpath = '/usr/bin/xpdf'
    pdfprog = 'xpdf'
else:
    pdfprogpath = '/usr/bin/mupdf'
    pdfprog = 'mupdf'

go = False
dldir = os.path.expanduser('~')+os.sep+'Downloads'
if not os.path.exists(dldir):
    os.mkdir(dldir)
args = sys.argv
if len(args) == 2:
    url = args[1]
    if url.startswith('file://'):
        url = url.replace('file://','')
        urll = url.split('#page=')
        f = urll[0]
        if os.path.exists(f):
            if len(urll) > 1:
                page = urll[1].split('&')[0]
                os.execl(pdfprogpath,pdfprog,f,page)
            else:
                os.execl(pdfprogpath,pdfprog,f)
    else:           
        if url.endswith('.pdf') or url.endswith('.PDF') or '.pdf#page' in url.lower():
            urll = url.split('#page=')
            f = dldir+os.sep+urll[0].split('/')[-1]
            if os.path.exists(f):
                go = True
            else:
                try:
                    fn,h = urllib.urlretrieve(urll[0],f)
                    go = True
                except:
                    pass
        if go:
            if len(urll) > 1:
                page = urll[1].split('&')[0]
                os.execl(pdfprogpath,pdfprog,f,page)
            else:
                os.execl(pdfprogpath,pdfprog,f)

Guenter
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer
Posts: 5025
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by Gomoto » Fri Mar 22, 2013 8:23 pm
Thanks for the input.

I am expanding the audio features of my pi right now. Quite content with mpd and mpc for radio stream playback (10%-12% CPU).

Regards
Posts: 106
Joined: Tue Feb 12, 2013 1:21 am
by gkreidl » Fri Mar 22, 2013 9:12 pm
Gomoto wrote:...
I am expanding the audio features of my pi right now. Quite content with mpd and mpc for radio stream playback (10%-12% CPU).
Regards


I've tested both and also gst123 in conjunction with an usb sound card. omxplayer does not support usb audio right now and the analog output is not exactly hifi. I had at least 20 - 30% cpu, but this may depend on the usb driver. The digital output of omxplayer is much better and I get never more than 10% cpu when playing music with omxplayer. I'll try mpd again with hdmi sound.

Guenter
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer
Posts: 5025
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by Gomoto » Fri Mar 22, 2013 9:32 pm
(I am using hdmi audio right now to stop the clicks. Audiowise I am glad that I did spend 20 Euro extra for HDMI on one of my LG monitors, the other one has only got DVI.)

Radio (*.m3u) playing web is uploaded (source and binary rc3)

(based on mpd and mpc:
sudo apt-get install mpd mpc)
Posts: 106
Joined: Tue Feb 12, 2013 1:21 am
by gkreidl » Mon Apr 08, 2013 3:32 pm
Meanwhile I have modified Gomoto's program in so many ways that I have decided to fork my own version from it. I call it "Minimal Kiosk Browser", the binary is named "kweb" and the only script needed (Python) does not conflict with any of Gomoto's scripts. So they can be installed independantly from each other.

One of the main differences is the implementation of a kiosk mode (hence the new name). I'll open a new thread as soon as it is available for download. See the attached README file for details.

Guenter

README kweb.gz
Readme file for Minimal Kiosk Browser
(4.57 KiB) Downloaded 181 times
Last edited by gkreidl on Tue Apr 09, 2013 2:35 pm, edited 2 times in total.
Posts: 5025
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by bfagioli » Mon Apr 08, 2013 8:42 pm
Are you sure you attached right file? The README first line says "Welcome to DVBlast!"
User avatar
Posts: 123
Joined: Sat Oct 27, 2012 11:49 pm
by gkreidl » Mon Apr 08, 2013 9:23 pm
bfagioli wrote:Are you sure you attached right file? The README first line says "Welcome to DVBlast!"


Thanks for the note. I've just replaced the file.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer
Posts: 5025
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by Holliss » Mon Apr 22, 2013 10:03 am
Trying to run latest version 1.06 and in fact a couple of the older versions too I always get a

a message about it not being a debian format archive and this:
dpkg: error processing web_1.0-6_rc3_armhf.deb (- - install):
control returned error exit status 2

Thanks,
Posts: 16
Joined: Fri Apr 19, 2013 12:33 pm
Location: London
by gkreidl » Mon Apr 22, 2013 10:33 am
I always cloned the source with git and installed it via "sudo make install". But you have to do that now both for web and omxtgtk as well.

For my own split-off (kweb, Minimal Kiosk Browser), I don't offer a debian package at all, but a tar.gz file. There is a rather large README file included, that explains how to install and configure it. omxtgtk is not needed.

Guenter
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer
Posts: 5025
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by Markodius » Thu Apr 25, 2013 1:35 am
Thanks for a fast browser Gomoto. It makes web browsing on Raspbian feel a bit closer to the RiscOS experience.

I did have one mysql error error browsing this forum: 'Too many connections'.
“In the modern age, to call a man unelectable means he cannot be bought”
Posts: 134
Joined: Fri Jan 04, 2013 11:14 pm
by pi3g » Wed Jul 03, 2013 11:14 pm
The MySQL error is, most probably not a browser bug.
Posts: 17
Joined: Mon Nov 05, 2012 9:58 pm
Location: Germany