Trigger On Demand Campaign by HTTP Request

When you publish an On Demand Campaign to Android and Windows Players, it is possible to trigger it by clicking the “Play” icon on the Player in your screenpublishing account, or through an 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 explain how to obtain the Campaign On Demand URL and trigger it on screen to desired parameters:

  1. Open the Player or Player Group in which you have published the On Demand Campaign.
  2. Go to the “Campaigns in Player” tab.
  3. The published Campaign will be marked as “Play On Demand”. Right click on the blue “Play” button and choose “Copy Link Address” to get a Playback URL.copy on demand campaign urlThe Playback URL can be used to automate playback of the Campaign on that specific Player, through a regular GET HTTP request:
    https://app.screenpublishing/play/VL3GR4qlL7ZcdHLOF4O0
  4. When doing so, there are some parameters to be used to control the playback behavior:
ParameterBehavior
repeatA number from 0 to 999 to specify for how long the Campaign should be played. The special value 0 indicates it’s repeated indefintely.
actionControls the On Demand Queue. Read more below.
Any otherAny 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 (repeat=0), having the parameter info available for the Campaign.

$ curl 'https://app.screenpublishing/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 content.

The screenpublishing Android Player version 7.0.3 or greater adds new ways of playing a Campaign on demand, through the action parameter.

ActionResult
playInterrupts the currently playing Campaign and starts playing the new content. Any existing queued content is discarded. This is the default if action is not specified otherwise.
queueQueues the new content to be played as soon as the currently playing Campaign is over. If there is other content in queue, they will be played first.
playqueueQueues the new content. If the currently playing Campaign is from a scheduled loop (meaning not played on demand), this interrupts it and starts playing the queue.

Those three actions allow for a myriad of interactions.

Examples:

Assume 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 in a sequence: If the player is playing “X” and you call:
https://app.screenpublishing/play/token_A?action=playqueue
https://app.screenpublishing/play/token_B?action=playqueue
https://app.screenpublishing/play/token_C?action=playqueue

The Player would immediately interrupt the Campaign “X” and start playing Campaign “A”, followed by Campaigns “B” and “C”.

    • Trigger another cCmpaign on demand and discard queue: Now assume that the Campaign “B” is playing and you call:
https://app.screenpublishing/play/token_A

The player would immediately start playing the Campaign “A”, followed by Campaign “X” which 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 in this scenario, because the queue is dropped when action=play.