Difference between revisions of "NeTV local UI"

From Studio Kousagi Wiki
Jump to: navigation, search
(Created page with "NeTV local UI is entirely rendered by Webkit browser, running in a chromeless/fullscreen fashion. The UI is written in JavaScript & HTML. Hardware integration is supported by sub...")
(No difference)

Revision as of 16:37, 2 November 2011

NeTV local UI is entirely rendered by Webkit browser, running in a chromeless/fullscreen fashion. The UI is written in JavaScript & HTML. Hardware integration is supported by submitting POST/GET request to http://localhost/bridge. See NeTV_web_services.

The starting point for playing with the UI is to edit files found in /usr/share/netserver/docroot This is translated to http://localhost

The overlay effect is done using chroma key compositing.
Any color that is (240,0,240 or #F000F0) will take on the color of the background video stream.

The browser executable is located at /usr/bin/NeTVBrowser To start/stop/restart the browser, use a helper script

/etc/init.d/chumby-netvbrowser start/stop/restart


To point the browser at a different URL
Note that, however, a keep-alive timer will kick in within 1 minute and switch it back to http://localhost/

NeTVBrowser SetUrl http://www.yoururl.com

The recommended way to keep a page on screen without losing the Control Panel is to use the browser's multi-tab feature

NeTVBrowser Tab hideall (hide all tabs except tab 0, will keep the tabs running)
NeTVBrowser Tab destroyall (destroy all tabs except tab 0)
NeTVBrowser Tab 1 http://www.yoururl.com
NeTVBrowser Tab 1 load http://www.yoururl.com
NeTVBrowser Tab 1 hide (will keep the tab running)
NeTVBrowser Tab 1 show (will not destroy other tabs)
NeTVBrowser Tab 1 close (destroy the tab)

Where the '1' argument is the index of the tab. Maximum 10 tabs are supported (index 9).
Tab 0 is reserved for NeTV UI, can be changed but do keep in mind there's a keep-alive timer.
A keep-alive timer is responsible to keep it pointing to http://localhost at 1 minute interval.

To turn off the keep-alive timer

NeTVBrowser KeepAlive off


To call or inject JavaScript function from SSH console (remember to escape special characters):

NeTVBrowser JavaScript "console.log('hello console');"
NeTVBrowser JavaScript "my_function();  function my_function() { console.log('hello console'); }"


Night mode (Tab 0 only)

NeTVBrowser InvertColor on
NeTVBrowser InvertColor off


Make the browser fullscreen / NOT fullscreen

NeTVBrowser Fullscreen
NeTVBrowser SetBox 100 100 400 300    //xx yy width height


Screen rotation

NeTVBrowser Rotate 0/90/180/270


Show debug traces & JavaScript console output

mount -o remount,rw /
vi /etc/init.d/chumby-netvbrowser

Replace NeTVBrowser > /dev/null 2>&1 & with NeTVBrowser &

mount -o remount,ro /


Simulate a keyboard event

NeTVBrowser Key valid_key_name

Some commonly used key names are: cpanel,widget,up,down,left,right,enter,center,esc,del,backspace,space & alphanumeric keys


Buttons on infra-red are treated as native keyboard keys in NeTV's Linux kernel (/dev/input/event1). However, by default NeTVBrowser overrides key press events in order to handle key counting, key sequence/combo, page scrolling & delivered directly to HTML Control panel as a JavaScript function call.
Example: Hold the control panel button on IR remote for more than 3 seconds & release it will reload/reset the Control Panel.
In order to have the IR buttons events delivered directly to JavaScript as normal keyboard events, use:

NeTVBrowser Nativekb On

The JavaScript in the loaded HTML page will have to handle scrolling & counting of key presses manually. The above mentioned reset functionality will be lost.

More interesting stuffs to come...