In this example you will learn how to use the remote API to control the FaçadeSignage player remotely.

Please make sure to understand how to start the HTTP or OSC receiver first following this guide.
In this example we will use HTTP calls, so the logic can be implemented in any external module and programming language (C#, Java, jQuery, ...)


Simple Player Application on current Set and Cue


Create a new project (or add a new Set in the DemoProject that comes with any FaçadeSignage installation).

Make sure you enabled the Web Receiver and add two surfaces, s0 and s1.


Also add some Media Resources and name them with a short name (or use the ones already existing in DemoProject).

We named two of the media files with simple names like clouds and ocean, these names will be used to reference the media files.

 


Both surfaces do not have any resource associated, we want to control them from an external application (for example an interactive application with a touchscreen selection, or ambient sensors).


We want the surfaces to be invisible while we change the resources, so we set their opacity to 0.

    

http://localhost:15000/api/setSurfaceIndexOpacity/0/0
http://localhost:15000/api/setSurfaceIndexOpacity/1/0 

    

Now we can assign the "ocean" resource to the surface s0 (which has index 0) and the "clouds" resource to the surface s1 (which has index 1).
We don't want the resource to start playing immediately, so we set the RewindPause method to rewind and pause them, waiting for a next play command.
  

http://localhost:15000/api/setSurfaceIndexResource/0/ocean/RewindPause
http://localhost:15000/api/setSurfaceIndexResource/1/clouds/RewindPause

  

Now we are ready to show them, setting the opacity to 1 and immediately playing the resources assigned to the surfaces:

 

http://localhost:15000/api/setSurfaceIndexOpacity/0/1
http://localhost:15000/api/setSurfaceIndexOpacity/1/1

http://localhost:15000/api/controlSurfaceIndexResource/0/Play
http://localhost:15000/api/controlSurfaceIndexResource/1/Play

 

Note that you can also send multiple setSurfaceIndexOpacity calls with a floating point number (using comma (,) as decimal number like 0,5 for 50% visibility) to create a fading in ramp, but doing so with HTTP calls would result in slow performance so we should either use OSC calls or use the next described method.


Programming Cues


The previous example applies changes the current Set and Cue.
We can also leverage Cues to program ahead the next cue and then play it, this way the player will be using the fade in/out settings and avoid a direct control of surface opacity (for example).


For our simple player we will use two Cues, so will add another one in the Set 2 (which has an index of 1 since all entities like sets, cues and surfaces always start from 0 in the API calls).

We will prepare media in Set 2 Cue 2 and play it, then we will prepare next media in Set 2 Cue 1 and play it, doing this again and again with different media we will achieve a smooth "swapping" effect of media using just two Cues.


Let's start from the previous example, we are in Set 2 Cue 1 now, with media already playing, let's program Set 2 Cue 2 assigning ocean media to both surfaces, and play Cue 2:
(Note that the first "1" means Set 2, the second "1" means Cue 2 and then the surface index as usual)

   

http://localhost:15000/api/setCueResource/1/1/0/ocean
http://localhost:15000/api/setCueResource/1/1/1/ocean

http://localhost:15000/api/playCue/1

   

Now we can do the same to program the previous Cue 1, assigning the clouds media and playing it:

 

http://localhost:15000/api/setCueResource/1/0/0/clouds
http://localhost:15000/api/setCueResource/1/0/1/clouds

http://localhost:15000/api/playCue/0

 

The Cue default fade is set to 2 seconds, we can change it as well for both cues to be 5 seconds for example:

 

http://localhost:15000/api/setCueFade/1/0/5/5/true
http://localhost:15000/api/setCueFade/1/1/5/5/true