SpinetiX Tech RemoteControl
SpinetiX Tech RemoteControl
SpinetiX S.A.
Rue des Terreaux 17, 1003 Lausanne, Switzerland
T +41 21 341 15 50 | F +41 21 311 19 56 | [email protected] | www.spinetix.com
Remote Control of HMP - SpinetiX Technical Documentation v2.3
Revision history
NOTWITHSTANDING ANY OTHER WARRANTY HEREIN, ALL DOCUMENT FILES AND SOFTWARE OF THESE
SUPPLIERS ARE PROVIDED “AS IS” WITH ALL FAULTS. SPINETIX DISCLAIMS ALL WARRANTIES,
EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THOSE OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT OR ARISING FROM A COURSE OF DEALING,
USAGE, OR TRADE PRACTICE.
In no event shall SpinetiX or its suppliers be liable for any indirect, special, consequential, or incidental
damages, including, without limitation, lost profits or loss or damage to data arising out of the use or inability
to use this manual, even if SpinetiX or its suppliers have been advised of the possibility of such damages.
"SpinetiX" and “HMP Hyper Media Player” are registered trademarks and the logo and all graphic designs
are trademarks of SpinetiX S.A. Other product and company names appearing in SpinetiX S.A. products and
materials are used for identification purposes only and may be trademarks or registered trademarks of their
respective companies. Registered and unregistered trademarks used in any SpinetiX S.A. products and
materials are the exclusive property of their respective owners.
The SpinetiX End-User Software License Agreement and Hardware Limited Warranty Agreement can be
found under http://www.spinetix.com/legal.
Table of Contents
Notices and Disclaimer ............................................................................................................................................................ 3
Support Wiki keywords .......................................................................................................................................................... 5
1. Introduction ....................................................................................................................................................................... 5
2. Remote control of content .......................................................................................................................................... 6
2.1. When to use .............................................................................................................................................................. 6
4. Remote triggers............................................................................................................................................................. 17
4.1. Triggering a text overlay ................................................................................................................................. 17
1. Introduction
This technical documentation covers various methods that you can use to remote control the
HMP (Hyper Media Player). You can control the content source, the playback of animations,
video or audio (for instance you can pause a video based on the user input), you can display
messages or contextual animations on an external event and many more.
From the connectivity point of view, there are three ways to control the HMP:
The network. The command might come from a PC, from a web page or from another
HMP.
The serial port of the HMP. A dedicated protocol file must be written to translate
RS232 command to a series of actions to be performed by the HMP.
The USB port of the HMP. Human Interface Devices (HID) such as keyboards or remote
pointers can be used to control the HMP.
From the software point of view, you can use the Hyper Media Director (HMD) templates, the
shared variables mechanism and / or custom JavaScript code.
All examples presented in this technical documentation follow the same structure:
For IP control, the commands will be sent over TCP with the telnet utility from the
command line or from sample client-side scripts in HTML pages.
For the serial port examples, we assume a simple protocol where each command is a
single character, so it can be exercised easily by connecting a PC on the serial port and
sending the right keys.
You can also use the “menu_buttons.svg” template which creates a menu with buttons to control
the menu_media template.
By default, the “Instant Messaging Variable” (shared variable) associated with this template is
called “menu” - this can be changed as well. Whenever the value of this shared variable is
changed by a network or serial port command, the player will switch to display the “page” with
the matching id.
In the "Interactive controls" property group you can change the predefined functions that, by
default, have the following values:
On the “Playlist” tab, you can define the possible media contents and associate a “Page Id” to
each one, as show in the image below. By default, the first media from the list is displayed.
Using the “Media description” dialog (click on the three-dot button to bring that up) you can
adjust the media duration and decide whether to play a page indefinitely or only for some time.
If the media has a finite duration and you have entered a media id in the "next page" column, the
player will switch to another media accordingly. This lets you trigger a small playlist if needed. If
you leave the "next page" field blank, the action taken depends on the "Next page by default"
option. You can chose to switch back to the first page (the default value), to go to the next page
or to play the same content again.
\r\n means that you send the characters with ascii code 13 (CR) and 10 (LF) to terminate the
command. This can be tested with the telnet utility which sends this sequence when you press
Enter.
The network API also supports setting shared variables via an HTTP GET request. This method
does not allow persistent connections, but it is easier to access from a client scripting language
supporting the XMLHttpRequest API, like JavaScript in web browsers.
To generate a command equivalent to the one above enter the following URI in a web browser:
http://[HMP_address]:[port]/update?menu=P1
The network API must be enabled on the Network Settings page for the HMP to accept the
connection. The port number can be changed on this page as well.
If you do not have an HMP at hand, you can test with the content running in the HMD application
on your PC. For this, check the "Enable Network API" box in the "Settings" menu. The TCP port
number is also 1234.
The examples below assume that the control variable is the default one ("menu") and you want
to switch to content with the Page Id equal to "P1".
Example #1
Create a simple project using the menu_media.svg template (don’t modify any of the properties)
and publish it to an HMP. Make sure to enable the network API on the device and to note the IP
address of the player. Assuming the IP address of the HMP is 192.168.1.10, type in "telnet
192.168.1.10 1234" on the PC, then the UPDATE command, then Ctrl+] and "quit" to terminate
the connection.
As soon as you hit enter after the update command, the display should switch for 5 seconds and
then revert to the default page.
To test the HTTP GET method with the previous example, enter the following URI in a web
browser:
http://192.168.1.10:1234/update?menu=P1
Example #2
The GET method can also be embedded in an HTML page. The example below will let you switch
the document each time you click on the button.
<html>
<script>
function set( name, value ) {
var request = new XMLHttpRequest();
request.open("GET", "http://192.168.1.10:1234/update?" +
encodeURIComponent(name) + "=" + encodeURIComponent(value),
false);
request.send();
}
</script>
<body>
<form>
<button onclick="set('menu','P1')">Click</button>
</form>
</body>
</html>
Create a protocol file (.fsm) describing the actions to be performed depending on the
input on the serial port.
o The protocol file should trigger an <update> action on the variable when
matching the input on the serial port.
Upload the protocol file to the HMP using the RS232 / USB IO page from Control Center.
Enable the protocol file by selecting it in the protocols drop-box.
Click the “Apply” button.
Send messages to the HMP using the serial connection.
Example
For instance the sample below will trigger an update of the menu variable when the string '1' or
'2' is received on the serial port.
The keystroke.svg template lets you associate keystrokes with a request to update the value of
the shared variable that controls the current media. You should have only one keystroke.svg
template, preferably as the background layer of the top index.svg, because if you have multiple
layers which accept keyboard events, you'll have to make sure the right one gets the focus. This
template has no displayable content and is fully transparent.
You specify the mapping from key to value in the "Key Identifiers" table. The syntax for the key
identifiers is documented in the SVG Tiny 1.2 specification. It has been extended to let you prefix
them with "modifiers", so as to match on the key stroke only if some other control key is down at
the same time. The valid modifiers are: Ctrl, Alt, Shift, AltGr and Meta. For instance to match a
stroke on "A" while the holding the Control key down, the key identifier is "Ctrl+A".
In the image below, a mapping is made for the key codes sent by common USB remote controls
used for PowerPoint presentations, while Ctrl+A combination triggers the alternate content of
the sample.
To generate this command you can use the 'menu_buttons.svg' template located in the
Interactivity folder. This template let you configure 'buttons' and associate each button with a
given action. This template can be used to control local or remote shared variables depending on
presence of the sign @ in the variable name.
Example #1
The example below shows the configuration of the file to control the value of the variable 'menu'
located on the remote 192.168.1.10 host.
Example #2
It is also possible to use JavaScript directly in the SVG code to control the value of the shared
variable. The sample code below assumes that we want to control the content on 192.168.1.10
by clicking on a rectangle.
Once the application has been started you can select any number of shared variables to be
watched or modified. To add a new shared variable press the 'Add Variable' button and type the
name of the variable to be watched. Make sure you use the complete name of the variable,
including the host name. Use 'localhost' as host name if you want to test your content on the
local PC (e.g. menu@localhost).
In the example below the variable 'menu' on the host '192.168.1.10' is being watched. The
current value for the variable is 'P1'.
To modify a variable, simply enter the new value in the Value column and press Enter. Then
watch the changes on the screen.
For playback control on multiple screens or better resilience, an optional timestamp can follow
the PLAY or PAUSE string. It is defined as the time position in seconds where playback should
pause or resume. This extra parameter enables unambiguous control over the timeline. If the
variable is stored in a central server, this let you control the playing (or pause) time even if the
target device was off or has restarted in between two commands. It also enables frame accurate
synchronization of playback on multiple targets as well as control over the current time position.
The timestamp can also be specified as a relative percentage of the total duration of the media if
followed by a percent sign. For instance to jump to the middle of the media, the value is: PLAY
50%.
To pause interactively the media, send the following command over TCP:
Playback will pause, respectively resume, at the time the command is sent. Because of latency,
the media may appear to step back in time a fraction of seconds when pausing. This can be
avoided entirely by specifying a timestamp in the future for the variable update.
To pause interactively the media, type the following command in your browser:
http://192.168.1.10:1234/update?playback=PLAY
http://192.168.1.10:1234/update?playback=PAUSE
The playback GET method can also be embedded in an HTML page. The example below will let
you play and pause the media from a remote web page. Note that you need to make sure that the
web page is stored on a 'trusted' web site otherwise the security settings of your web browser
might prevent you from using the XMLHttpRequest().
Example
<html>
<script>
function set( name, value ) {
var request = new XMLHttpRequest();
request.open("GET", "http://192.168.1.10:1234/update?" +
encodeURIComponent(name) + "=" + encodeURIComponent(value),
false);
request.send();
}
</script>
<body>
<form>
<button onclick="set('playback','PLAY')">Play</button>
<button onclick="set('playback','PAUSE')">Pause</button>
</form>
</body>
</html>
To use the 'menu_buttons.svg' file to control the playback, you need to configure the name of the
shared variable to 'playback' or 'playback@hostname'. You then need to configure the action
related to the button to trigger the PLAY and PAUSE commands.
To pause the playback at a precise position, say at 7 seconds, you would send the following
command:
If you wish to resume playback, just send a PLAY command with the same position as the last
PAUSE.
It is also possible to use a relative position depending on the content duration to control the
pause and play time. In this case the position should be specified in %.
For instance, to seek at 10% from the start of the media, send the following command:
Note that if the controlled media is set to loop, the progress percentage resets to zero when the
media loops, while the absolute time position does not.
In order to use the play / pause commands with time position you need to deduce the current
position. When sending a play command to resume playback, you can simply copy it from the
current value of the playback variable.
4. Remote triggers
Remote triggers let you display some text, image, video or animation on the HMP controlled
from a remote server. For instance, you can display a message on all the HMP of a building or a
“GOAL!” message on the screen of the stadium. The same procedure can be used to control which
image or video is displayed from a remote server.
Select a name of a shared variable which you'll use to set the text message.
In the "RSS Feed Source" property, enter the name of the shared variable followed by
@localhost.
Select TXT for the "Feed Type" property.
Set how long you want the message to display in the "Item Duration" property.
Set the "Looping" property to “off”.
Switch to edit mode and use a text area with [SPX][title] as the content, at the location
where you want the message to appear.
Insert the news template as a new layer in the main document.
The template will remain transparent until you set some text for the chosen variable. Whenever
you will update the content of this variable, your message will show for the configured duration.
Example
The image below shows HMD playing such news template using the variable
'message@localhost' to control the message. SpinetiX Messenger is used to trigger the message.
You can also use directly the Network API, like in the previous example, to trigger the update of
the text.
Example #1
If the media is known in advance you can ignore the content of the variable and just use the
shared variable update event as a trigger.
To display videos and / or images based on a shared variable trigger, follow the steps below:
Use the news template together with a shared variable as within the previous example.
Switch to the edit mode and create your layout using your videos and / or images.
o Note that you don't need to use [SPX][title] tag in your document since you are
not interested in the content of the shared variable.
o If you plan to play a video make sure that the duration of the slide is longer than
the duration of the video.
The videos or images will be displayed for the duration of the slide each time the trigger
is received.
The example below shows a video trigged whenever the variable 'message@localhost' is
modified. The item duration has been set to 'indefinite' so that the video is played fully at each
trigger.
Example #2
Alternatively you can use the content of the variable as a filename or URI for the image. In this
case follow the step below:
Use the news template together with a shared variable as for the previous examples.
Go to the Layers tab and insert a new media.
Open the media properties dialog box (press the [...] button).
In the URI field, type [SPX][title]. This means that the content of the shared variable will
be used as the address of the file to be opened.
Using any of the Network API methods, you can changes the shared variable to the
address of the file you want to display. You can use a relative path or a complete URI.
The example below shows a media controlled trough a shared variable. The shared variable is
set to the URI of an image on the spinetix.com web site. The value of the shared variable is
controlled using the HTTP GET method.
Alternatively, the new_ticker.svg template may be used if you want the message to scroll through
the screen when triggered.
Note that the methods presented here can also be applied to permanent content, such as a score
overlay on sports content by giving a large enough duration for the slide. Effects can be used in
this case to render the transition visible or not used to make a silent change.
To create such content, use the procedure described in 'Remote control of content' described at
the beginning of this document. You'd typically set the normal content as the default media (the
first one on the list). Then each additional id will be associated to each one of the alternative
contents with their duration.
To trigger the display of an alternative content, set the control variable (default name is "menu")
to the corresponding id. Once the media has been played, the content will revert to the normal
media which will play again from the beginning.
It might be desirable for the main media not to start over each time it is reopened. In this case
two scenarios are possible.
The main media resume its playback, as if paused during the alternative content.
The main media continue playing, as if playing in the background during the alternative
content.
The first scenario can be controlled using the 'Resume where left' parameters of the
menu_media.svg template. Settings this parameter to 'on' will prevent the main media from
restarting each time it is opened.
To do this, you design the animations as if they are triggered by time, but use "indefinite" as the
begin attribute. In a <script> element you instantiate a shared variable for remote control and
add an update listener on that variable. Finally, from its callback function, use the
beginElement() or beginElementAt() methods of the smil::ElementTimeControl interface to
trigger the animation.
Example #1
In the sample below, a rectangle is set to move through the screen from left to right when then
the "kick" shared variable is set to "go".
Example #2
You can also use the content of the shared variable to modify the document on the fly.
For instance in the example below a rectangle will flash for once second each time the variable is
updated and its color is set to the content of the variable.