Slicer Module Reference
Every method the slicer module exposes to a Python SCTE plugin, with its parameters and return values.
Slicer Module
The slicer module provides a way for your plugin to call functions and manipulate slicer state.
The available functions are:
| Function | Description |
|---|---|
| AdEnd | Explicitly ends an ad break. |
| AdMeta | Adds metadata to an ad break. |
| AdStart | Starts an ad break. |
| Blackout | Initiates blackout mode. |
| ContentStart | Starts a new asset. |
| EndBoundary | Ends an ad boundary. |
| FlushBreakMeta | Defines the presentation timestamp (PTS) at which the metadata defined via the MetaMetadata function will be applied. |
| GetState | Indicates the current Live Slicer state. |
| GetStatus | Returns Live Slicer status and configuration information. |
| Initialize | Initializes the slicer module. |
| Metadata | Adds metadata to the asset currently being sliced. |
| MetaMetadata | Adds metadata to the asset associated with the next segment. |
| SlicerLogger | Logs error conditions, informational messages, and debug messages. |
| StartBoundary | Starts an ad boundary. |
| TimedMeta | Adds metadata as an ID3 tag at the presentation timestamp (PTS). |
*Note: PTS referred to in the following sections is the presentation time stamp
Initialize
Initializes the slicer module. Call this function via the Initialize() function as shown above.
def Initialize():
return slicer.Initialize()
def Notify():
return int(0)GetState
Returns a string that indicates the current Live Slicer state.
Valid values are:
- start_blackout: Indicates that the Live Slicer started up and remains in blackout mode.
- slicing: Indicates that the Live Slicer is currently slicing.
- adbreak: Indicates that the Live Slicer is in an ad break.
- replace: Indicates that the Live Slicer is in replace content mode.
- blackout: Indicates that the Live Slicer is in blackout mode.
Sample request:
slicer.GetState()GetStatus
Returns Live Slicer status and configuration information. The response for this function may contain the following parameters:
| Parameter | Type | Description |
|---|---|---|
| status | Object | Contains Live Slicer status information. This object is similar to the status object returned by the status endpoint from the Live Slicer API. |
| config | Object | Contains Live Slicer configuration file settings. |
| slicerID | String | Identifies the Live Slicer's ID as defined in the Live Slicer configuration file. |
| externalID | String | Indicates the external ID that will be assigned to the CMS asset created from the live stream. |
Sample request:
slicer.GetStatus()Blackout
Initiates blackout mode at the specified PTS.
Sample request:
slicer.Blackout(int(pts))ContentStart
Starts a new asset at the specified PTS. The Description and External ID arguments are optional.
Sample request:
slicer.ContentStart(int(pts), "Description", "External ID")AdStart
Starts an ad break at the specified PTS. The Duration argument is optional. If omitted, you must call AdEnd() to end the ad break.
Sample request:
slicer.AdStart(int(pts), int(duration))AdEnd
Explicitly ends an ad break at the specified PTS.
Sample request:
slicer.AdEnd(int(pts))AdMeta
Adds metadata to a specific ad break. Call AdMeta before starting an ad break.
This function only adds metadata to a specific ad break. It is not applied globally across all ad breaks.
Sample request:
slicer.AdMeta("key", "value")FlushBreakMeta
Defines the presentation timestamp (PTS) at which the metadata defined via the MetaMetadata function will be applied.
Sample request:
slicer.FlushBreakMeta(int(pts))Metadata
Adds metadata to the asset currently being sliced as determined by the next video frame.
Metadata may be incorrectly applied to an asset under certain conditions. For example, metadata may be applied to the previous asset when this function is called directly after a content_start. The recommended method for setting metadata is via the
MetaMetadataandFlushBreakMetafunctions.
You can view the metadata associated with an asset from within the CMS.
Sample request:
slicer.Metadata("key", "value")MetaMetadata
Adds metadata to the asset associated with the next segment as determined by content start, ad start, etc.
The recommended method for associating metadata with an asset is to set it via the MetaMetadata function and then define the presentation timestamp (PTS) at which it will be applied via the FlushBreakMeta function.
You can view the metadata associated with an asset from within the CMS.
Sample request: print slicer.MetaMetadata("key", "value")
slicer.MetaMetadata("key", "value")SlicerLogger
Logs error conditions, informational messages, and debug messages to the terminal and syslog.
Valid log levels are:
- error: Logs error conditions.
- info: Logs informational messages.
- debug: Logs debug-level messages that may be used to troubleshoot an issue.
Syntax: print slicer.SlicerLogger("{Log Level}", "{Log Message}")
Sample request:
slicer.SlicerLogger("info", "Started an asset boundary.")StartBoundary
Starts an asset boundary. If a boundary is already active, this call is ignored. The Duration argument is optional. If omitted, call EndBoundary() to explicitly end an asset boundary.
Sample request:
slicer.StartBoundary(int(pts), name, int(duration))EndBoundary
Ends an asset boundary. This function is ignored when there is no active boundary.
Sample request:
slicer.EndBoundary(int(pts))TimedMeta
Adds metadata as an ID3 tag at the presentation timestamp (PTS).
Syntax: print slicer.TimedMeta({Presentation Timestamp}, {Metadata Key}, {Metadata Value})
Sample request:
slicer.TimedMeta(int(pts), "key", "value")Updated about 2 hours ago