Introduced in NextPVR v2.3.6, the 'touch' web service is an experimental feature to allow 'remoting' of the NextPVR user interface using a standard HTTP connection.
This page is to explain a little about how it works and is aimed mainly at those who want to create their own clients for smartphones, tablets and other remote devices.
The details here are fairly basic at the moment but if you understand how to work with HTML, Javascript and jQuery you shouldn't have a problem. I understood little about this stuff a few weeks ago and somehow 'volunteered' myself to rework Sub's initial version (learning a great deal along the way). :D
Using the service
Access to the service is through NextPVR's built-in web service using a URL in the following format...
Files
The relevant files are found in the NextPVR 'data' folder under \web\touch
How it works
The 'touch' client is served by an instance of NextPVR.exe in the same way as MVPs / NMTs are served. The key part is an HTML <img /> element which is updated at each key-press, mouse-click or touch-screen action. The first image is retrieved in client.html as follows...
The setImageSource() function is part of nextpvr.touch.common.js which in turn calls the relevant function in the 'client type' javascript file.
The code for subsequent image updates can be found in the different Javascript 'client type' files and also the nextpvr.touch.wipetouch.js file.
Touch-screen fundamentals
The service uses a jQuery plugin called WipeTouch. The NextPVR \web\touch distribution includes a version which I modified to provide customisable click / double-click functionality (nextpvr.wipetouch-1.1.0-mod.js).
To change the click / double-click parameters, modify the nextpvr.touch.wipetouch.js plugin with the parameters used to initialise the WipeTouch plugin (values in milliseconds)...
Playing media and watching Live TV
After each 'click' or 'double-click' or Enter key-press, the Javascript needs to use the following URL to see if there is any further action to take with respect to streaming media or playing Live TV...
The response string will either be empty (CR/LF only) or will provide a URL stub to append to the server/port as an HTTP GET request in order to stream. The responses are commented in the 'client type' Javascript files and will be one of the following.
or
These will also need to be appended to the server/port URL and passed to a media player. The 'transcode' is for Live TV and 'stream' is for Music, Recordings and Videos.
Client types
In order to separate platform specific behaviour, I opted to create individual Javascript files with a naming convention as follows...
nextpvr.touch.<client-type>.js
Each of these platform specific files should implement the same functions (even if they do nothing).
At the time of the release of NextPVR v2.3.6, files are included for 'generic' and 'android' platforms.
In order to support other platforms, the current mechanism is to examine the User-agent part of the first HTTP request to try to identify a unique string.
The 'generic' version should work with standard PC browsers for demonstration purposes although streaming and Live TV will NOT work.
For an Android app to use for testing, search the Android Market for ntouch nextpvr. Please note it is experimental and provided for demo purposes only. To play audio/video you will need suitable 3rd party apps installed on your device. I'll be providing source code as an example for any other Android developers to use freely ASAP.
Skin
As the clients may be 'small screen', there is an option in the NextPVR config.xml file to provide a separate skin to allow customising the UI.
- <WebClientSkin>Touch</WebClientSkin>
I've made a copy of the default skin with a few modifications for small screens. Download:Touch.zip
Page last modified on October 09, 2016, at 01:50 PM