Player API

Placeholder

You can use placeholders in modules using the {{variable|default}} format to populate dynamic content through the Player API. The value “variable” corresponds to the key of the API call, which is replaced by the value given there. In addition, you can optionally use “default” to define a default value for the placeholder that is used if no value or an empty text (“”) is returned in the Player API for the key that is used.

Example:
This is my example text with a dynamic number “{{number|50}}” inside the text.

Calling the Player API at the endpoint with the parameters { “key”: “number”, “value”: “100” } will change the result from “{{number|50}}” to “100”.

POST “https://[IP]/api/variable” { “key”: “number”, “value”: “100” }

This is my example text with a dynamic number “100” inside the text.

In the initial state of the player after startup or by clearing the value via API, the default value “50” is displayed in this example.

POST “https://[IP]/api/variable” { “key”: “number”, “value”: “” }

This is my example text with a dynamic number “50” inside the text.

Of course, you can use multiple placeholders in the module at the same time.

 

Change playlist

You may change your player playlist externally by using the player API. Just set the key “playlistID” and ID of the desired playlist the via Player-API to change the currently active playlist of a player. You may find the playlist ID by opening a playlist and inspect the URL in the browser bar, e.g. https://cockpit.framr.tv/channels/schedule/1234/.

Example:

POST “https://[IP]/api/variable” { “key”: “playlistID”, “value”: “[ID]” }

 

The target player will then view the specified playlist until either you reset the “playlistID” again via API or reboot your device.

Example:

POST “https://[IP]/api/variable” { “key”: “playlistID”, “value”: “” }

Cloud API

You can also set a variable via the Server API. To do so, send a POST request to the endpoint https://api.framr.tv/tv/device/actions/var/ and include the following parameters:

  • secret: API key … you can generate an API key in the group settings
  • id: Player ID … you can find the Player ID at the end of the browser URL after clicking on a player in the cockpit
  • key: Variable name
  • value: Value

To set multiple variables simultaneously via the Server API, use the following parameters:

  • secret: API key … you can generate an API key in the group settings
  • id: Player ID … you can find the Player ID at the end of the browser URL after clicking on a player in the cockpit
  • key[]: Array of variable names
  • value[]: Array of corresponding values
  • key[]: Array of variable names
  • value[]: Array of corresponding values

This method allows you to set multiple key-value pairs in a single request, which is particularly useful for efficiently adjusting multiple dynamic contents in the player.

Example:

This is my sample text with a dynamic number “{{zahl|50}}” in the text.

By calling the Player API to the endpoint with the parameters { “key”: “zahl”, “value”: “100” }, the output will change from “{{zahl|50}}” to “100”.

POST “https://api.framr.tv/tv/device/actions/var/” { “secret”: [API-KEY], “id”: [PLAYER-ID], “key”: “zahl”, “value”: “100” }

This is my sample text with a dynamic number “100” in the text.

In the initial state of the player after startup, or by deleting the value via the API, the standard value “50” will be displayed again for this example.