Trigger On Demand Campaign by HTTP Request

When you publish a campaign On Demand to Android and Windows players, it is possible to trigger it by clicking on “Play icon” within the player, or through a HTTP request.


Don’t you know what is an On Demand campaign? Check out the tutorial How to publish On Demand Campaigns


publish campaign on demand

In this tutorial we will explain how to obtain the campaign on demand URL and trigger it on the screen according to the desired parameters:

  1. Open the player or group of players in which you have published the campaign on demand.
  2. Select "Campaigns in Player" tab.
  3. The published campaign will be marked as "Play On Demand". Right click the blue play button and choose "Copy Link Address" to get a Playback URL. copy on demand campaign url
    The Playback URL can be used to automate playback of that campaign in that specific player, through a regular GET HTTP request:
  4. https://app.onsign.tv/play/VL3GR4qlL7ZcdHLOF4O0
  5. When doing so, some parameters can be used to control the behavior of playback:
Parameter Behavior
repeat A number from 0 to 999 to specify for how long the campaign should be played. Special value 0 indicates that it should be repeated indefinetly.
action Controls the On Demand Queue. Read more bellow.
Any other Any other parameter added to the Playback URL gets forwarded to the player and is available through Javascript on signage.playbackInfo()

Example:

Requesting the URL below will cause the player to play an item indefinitely, having the parameter info available for the campaign.

$ curl 'https://app.onsign.tv/play/VL3GR4qlL7ZcdHLOF4O0?repeat=0&info=1234'

Using the On Demand Queue

By default, the campaign playback starts as soon as the Playback URL is accessed, interrupting whatever is currently playing, be it either scheduled or other on demand campaign.

OnSign TV Android Player version 7.0.3 or greater adds new ways of playing a campaign on demand, through the action parameter.

Action Result
play Interrupts the currently playing campaign and starts playing the new content. Any existing queued content is discarted. Default if action is not specified.
queue Queue the new content to be played as soon as the currently playing campaign is done. If there is other content in the queue, they will be played first.
playqueue Queue the new content. If the currently playing campaign is from a scheduled loop (meaning not played on demand), interrupt it and start playing the queue.

Those three actions allow for a myriad of interactions.

Examples:

Assume that a player has the campaigns "A", "B" and "C" published on demand, while having two campaigns playing through the scheduled loop: "X", "Y".

  • Trigger three campaigns on demand on a sequence: If the player is playing "X" and one calls:
  • https://app.onsign.tv/play/token_A?action=playqueue
    https://app.onsign.tv/play/token_B?action=playqueue
    https://app.onsign.tv/play/token_C?action=playqueue

    The player would immediately interrupt the campaign "X" and start playing campaign "A", followed by campaign "B", and "C".

  • Trigger another campaign on demand and discard queue: Now assume that the campaign "B" is playing and one calls:
  •    https://app.onsign.tv/play/token_A

    The player would immediately start playing the campaign "A", followed by campaign "X", that was previously interrupted. After that it would resume the loop, playing "Y", "X", "Y", and so on.
    Please mind that campaign "C" would not play on this scenario, because the queue is dropped when action=play.