How to Adjust Countdown for Ad Blocks?

LetТs consider an example of creating a counter that displays time to the end of the current ad block. This task can be solved by using the system of rules for a Program Channel (Actions) and elements of the SL NEO API-platform.


Actions is a specialized mechanism used in SL NEO server software, which allows the user to realize an event model of broadcast automation. The system of rules can help the user to program execution by the server of certain actions in case of triggering the set conditions. The condition for triggering the rule is the approach of a certain event in the playlist, the condition is set in the process of configuring the rule. After the approach of a condition, the server executes the defined action. There is a set of certain actions for setting up their executing.


API of the SL NEO platform is the programming interface for interaction of third-party applications with the server. API includes a range of functions for managing graphic design, some API functions can be called up directly from the rules (Actions) without participating of third-party applications. In our example we will use API functions for work with the graphic elements of the type Text Counter, set the value for the counter and launch countdown.


For an example we will need a playlist that consists of programs and ad-films.




For clarity, ad-films are selected with yellow, every block starts with the bumper УAd blockФ. All advertising events in the column Type have the value УadvФ as an identifier, by which the server can separate commercials from other programs.


For our example we will need a graphic composition that will contain an element Text Counter.




The element CountDownToNext is a counter that has the type Text Counter. Set the value External for the parameter Type of the counter - this will provide controlling the counter programmatically from without. The type of counting for the counter is Backward.


Adjustment of the graphic layer containing a counter


Open the menu section Status of the server control web console, in the appropriate window ProgramChannel choose one of the menu items Graphics 1...N - this will be the layer that will contain the counter. In the opened window, choose URL in the field Source type, enter the name of the graphic composition containing the counter into the field Source Name (see the field Media in the window Media Browser). 


Creating the first rule for a program channel


The first rule will trigger on those lines of the playlist that have the value in the column Type, equal УadvФ, the rule will also set for the counter a value equal the time period till the beginning of the next program. LetТs consider the playlist lines with the values in the field Type that are not equal УadvФ, as the programs. For setting the timer value, use the API-command counter_set_val.


Implement the following actions in the server control web console:


Find the tab Program Outputs in the section Manage, click the item Actions in the appropriate Program Channel, choose Add action. In the opened window specify a random name for a new rule in the field Name, choose the layer in which the rule will trigger, in the field Layer. Choose У1Ф - the first full screen layer (the layer of the main playlist). In the field Address set the IP address of the server, or leave the field empty, if the value is localhost. Press the button ... near the field Service and choose the appropriate service of the Program Channel, press the button ... near the field Action and choose Graphics action - the action that will be implemented by the server in case of triggering the rule.




Implement adjustments in the section Action condition according to the picture. Set the condition for triggering the rule: Уif the value in the field Type of the current column of the main playlist is equal advФ.


Implement configuring in the section Action parameters: enter the command counter_set_val into the field Param1 - this API command sets the timer value. In the field Param2 enter the name for the graphic compositionТs element with the type Text Counter, which value we want to set up. In our example, this is the counter - the object with the name CountdownToNext.


Next_item_field.jpgIn the field Param3 you should adjust automatic calculation of time till the next Уnon-advertisingФ program. To implement this, press the button ... near the entry field and choose the item Next Item field... in the opened window. Implement configuring in the new opened window according to the picture. We have configured the search of the nearest playlist line with the value in the column Type as not equal УadvФ, and the substitution of the temporal value till the beginning of this line in the field Param3.


Enter the value УstartФ into the field Param4 and press OK.




Creating two rules that will hide the counter during regular programs and show it during the ad blocks.


The rule for displaying the counter during commercials uses the API function - object_show.




The rule for hiding the counter during regular programs uses the function object_hide.




Adjustment is finished, press the button Apply Changes at the upper section of the web-console. The configured program channel will be reloaded.