The following steps are required to configure Prisma for Manifest Conditioning:

1. **[Input configuration](/traditional-products-and-appliances/components/manifest-conditioning/configure#configure-input)**: ESAM and streaming protocol settings. Depending on chosen protocols (DASH, HLS and HSS), manifest conditioning tab will dynamically appear.
2. **[Event identification configuration](/traditional-products-and-appliances/components/manifest-conditioning/configure#configure-event-identification)**: in this section, we configure the type of SCTE-35 to be filtered. SCTE-35 can be used to characterize placement opportunity in different ways: provider ad break start/end, distributor ad break start/end, program start/end etc. depending on the nature of the placement opportunity, the conditioning information will be managed differently.
3. **[HLS/DASH/HSS conditioning configuration](/traditional-products-and-appliances/components/manifest-conditioning/configure#hlsdashhss-conditioning)**: based on input configuration, dedicated tab will appear, enabling manifest conditioning configuration for each and every event identification configured in previous section.

Prior to configuring all the above, you need to add a **Manifest Conditioning** service:

1. Select **Add service** then select the **Manifest Conditioning** processing type.

2. Give a distinct name to this service.

## Configure input

Once a **Manifest Conditioning** service is created, the **Input** tab must be configured first.

<table>
  <thead>
    <tr>
      <th style="text-align: left">Parameter</th>
      <th style="text-align: left">Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: left">Version</td>
      <td style="text-align: left">Select <strong>2013</strong> or <strong>2016</strong> depending on the ESAM version supported. <strong>Auto</strong> allows Prisma to automatically detect the version from the request sent by the packager.<br><strong>Note:</strong> For sake of consistency, we recommend setting either 2013 or 2016.</td>
    </tr>
    <tr>
      <td style="text-align: left">Plugin</td>
      <td style="text-align: left">Select the manifest conditioning plugin to use.<br>- The <strong>Plugin</strong> section is only displayed if several plugins have been loaded, else default MediaKind plugin is used.<br>- Plugins are available from the <strong>Settings</strong> menu (see <a href="/traditional-products-and-appliances/components/manifest-conditioning/plugins">Manage Manifest Conditioning plugins</a>).</td>
    </tr>
    <tr>
      <td style="text-align: left">Streaming protocol</td>
      <td style="text-align: left">Configure the way manifest will be conditioned on a per streaming formats basis.<br>Possible values: <strong>HLS</strong> (HTTP Live Streaming), <strong>DASH</strong> (MPEG-DASH), <strong>HSS</strong> (Smooth streaming). See <a href="/traditional-products-and-appliances/components/manifest-conditioning/configure#hlsdashhss-conditioning">HLS/DASH/HSS conditioning</a> for more details.</td>
    </tr>
  </tbody>
</table>

## Configure event identification

Once the **Input** is configured properly, events to identify must be configured.

In case multiple segmentation descriptors (per time signal) are to be supported, one event identification shall be configured per segmentation descriptor.

Upon SCTE-35 detection, a packager will establish a communication with Prisma using ESAM (see request example earlier).

The SCTE-35 conveyed via ESAM may describe different types of placement opportunity, like for instance

- Ad break start/end
- Program start/end
- Etc.

Resulting manifest conditioning must then be adapted based on the type of event, hence this event identification step.

1. From the **Event identification** tab, select **Add identification event**.

   A window opens, providing option for pre-defined SCTE-35 event identification (template).

2. Select a value (**None** value allows configuring filtering rules without any pre-configured value).

3. Select **Ok**.

   Once selected, a configuration panel allows configuring the event one wants to filter out.

4. Configure filters: filters can be configured with logical expressions (AND/OR), leveraging any information from the ESAM request, including the SCTE-35 (interpreted by Prisma so that any attribute can be used as filter attribute).

<blockquote data-callout="note"><strong>Note</strong><p>If the filtering rules are related to segmentation descriptors, it returns one response per descriptor. Otherwise, there will be one response only, even if several descriptors are present.</p></blockquote>

Once the events are configured, conditioning on a per streaming formats basis must be configured.

## Manage variables

Prisma comes with a pre-configured set of variables that you can use to manage event filtering, as well as conditioning for HLS, DASH and HSS.

### Display variables

To see the list of variables, follow these steps:

1. Select the **Variables** tab.

   Predefined variables are displayed:

<blockquote data-callout="note"><strong>Note</strong><p>It is not possible to list all the possible variables. It is especially true when extracting a given value from an SCTE-35 segmentation descriptors: assuming that an SCTE-35 submitted by a packager contains multiple segmentation descriptors, you may want to use in your HLS or DASH conditioning the segmentation duration corresponding to the segmentation descriptor which type ID equals 0x10 (program start), and not the one corresponding to type ID = 0x01 (content identification).</p></blockquote>

2. [You can create a custom variable](/traditional-products-and-appliances/components/manifest-conditioning/configure#create-a-variable).

### Create a variable

To extract a well-defined value (such as the segmentation duration of the segmentation descriptor which type ID = program start), you need to create a variable.

To create a variable, proceed as follows:

1. Select **Add** located at the bottom left of the variables table.

2. Enter and/or select the appropriate value for each parameter.

3. Configure a **Name** for your newly created variable.

4. Enter a **Description** providing information about the variable.

5. Configure the **Path**: select `Edit` icon to select the variable you want to extract:

   1. Under **XPath**, navigate in the SCTE-35 as follows: **AcquiredSignal** > **SCTE35PointDescriptor** > **SegmentationDescriptor**, and select the **\[i]** located at the same level as **segmentationDescriptor**

   2. Select **segmentationTypeId** and associate the value **16** (decimal, which equals 0x10 for program start per SCTE-35 standard).

      ![The Edit path window shows the ESAM request tree and selectable SCTE-35 fields.](/images/prisma-guide/variable-path.png)

   3. Select `Edit` icon.

   4. Select **segmentationDuration**.

      ![The Edit path window shows the duration field selected beneath the segmentation descriptor.](/images/prisma-guide/duration-path.png)

   5. Leave **Method** set to **None**.

   6. Select **Ok**.

   The path to retrieve the desired value is now configured. You need to finalize the configuration.

6. Configure the following settings.

   <table>
     <thead>
       <tr>
         <th style="text-align: left">Parameter</th>
         <th style="text-align: left">Description</th>
       </tr>
     </thead>
     <tbody>
       <tr>
         <td style="text-align: left">Type</td>
         <td style="text-align: left">Associate the most appropriate type for this value, here <strong>Number</strong>.</td>
       </tr>
       <tr>
         <td style="text-align: left">Group</td>
         <td style="text-align: left">SCTE-35 variables are grouped following a certain order. Here, <strong>SegmentationDescriptor</strong> is appropriate so we can quickly locate our new variable when using it by looking at the <strong>SegmentationDescriptor</strong> section in the drop-down list</td>
       </tr>
       <tr>
         <td style="text-align: left">Event filter</td>
         <td style="text-align: left">Shall be enabled in case the variable must be used for event identification.</td>
       </tr>
       <tr>
         <td style="text-align: left">Response</td>
         <td style="text-align: left">Shall be enabled in case the variable must be used for conditioning.</td>
       </tr>
     </tbody>
   </table>

You can now use this variable for instance in the conditioning process, by associating a given key (here DURATION) with the value corresponding to the newly created variable:

![The HLS tag attribute selector associates a duration variable with the conditioning response.](/images/prisma-guide/associate-duration.png)

## HLS/DASH/HSS conditioning

Once the different events to identify are configured, you can configure the way manifest will be conditioned on a per streaming formats basis.

The conditioning processing is summarized in the table below.

<table>
  <thead>
    <tr>
      <th style="text-align: left">Parameter</th>
      <th style="text-align: left">Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: left">HLS</td>
      <td style="text-align: left">Configurable tags identifying the first, intermediate and last chunk of the event. Those are usually tags such as.<br> Default tags used as part of Prisma are: <code>#EXT-X-CUE-OUT</code>; <code>#EXT-X-CUE-IN</code> and <code>#EXT-X-CUE-SPAN</code>.<br> However, those tags are fully configurable when using the “expert” mode, enabling any type of tags like: <code>#EXT-X-SCTE35-OUT</code>, or Apple defined tags such as <code>EXT-X-DATERANGE</code> to give an example.<br>For each of those tags, the user will be able to attach a list of attribute and value to enrich the placement opportunity signaling like the ID of the splice, the duration, elapsed time since the break started etc.</td>
    </tr>
    <tr>
      <td style="text-align: left">DASH</td>
      <td style="text-align: left">The conditioning information sent by Prisma is conveyed within an <code>&lt;EventStream&gt;</code> element. The value is configurable (plain text, SCTE-35 XML encoded in base64 URL etc.)</td>
    </tr>
    <tr>
      <td style="text-align: left">HSS</td>
      <td style="text-align: left">Conditioning information sent by Prisma is embedded within a sparse track, as plain text, XML SCTE-35 in base64 URL, binary etc.)</td>
    </tr>
  </tbody>
</table>

### HLS Manifest Conditioning

Follow these steps:

1. Go to the **HLS Conditioning** tab.

2. In the drop-down list, select the Event you want to see conditioning.

   In the example below, we have two different events:

   - one identifying a program start,
   - another one identifying an ad break.

3. Once selected, you can select a Template that provides the flexibility to pre-configure your conditioning, which you can override as desired.

<blockquote data-callout="note"><strong>Note</strong><p>An <strong>Enable expert mode</strong> check box is available if you are comfortable enough with ESAM standard and conditioning process (XML-based configuration).</p></blockquote>

4. Select the **Splice Insert Out with segmentation descriptor** template.

5. Select **Ok**. The HLS manifest conditioning configuration comes with a pre-defined set of tags in this case.

6. To modify the attribute and value of any tag, select the attribute, **ID** for instance: you can modify the attribute name or modify the associated value from a drop-down list.

   you can select a value from a list of predefined values, which meaning is described in the **Variables** tab.

<blockquote data-callout="note"><strong>Note</strong><p>Most of these field are derived from the SCTE-35 received as binary from the packager ESAM request. Additional fields such as acquisitionPointIdentify are ESAM defined attribute from the request.</p></blockquote>

7. Validate the changes or add new conditions.

   A preview of the ESAM response from Prisma back to the packager is given underneath the manifest conditioning configuration:

<blockquote data-callout="note"><strong>Note</strong><p>This ESAM preview cannot be modified, in particular the tags used which in this case are hardcoded with the following values: <code>#EXT-X-CUE-OUT</code>, <code>#EXT-X-CUE-IN</code>, <code>#EXT-X-CUE-SPAN</code>.</p></blockquote>

8. For a full control over the ESAM preview, you need to select the **Enable expert mode** when adding conditioning for HLS. In this case, pre-defined tags are not defined, instead, you can modify everything within the ESAM preview window.

   ![In expert mode the ESAM response editor offers tag values as you type.](/images/prisma-guide/hls-expert-mode.png)

   **Change the tag naming**: In our example, we replaced `#EXT-X-CUE-OUT` with `#EXT-X-AD-BREAK-OUT`. You can also modify corresponding attribute and erase the value.

<blockquote data-callout="note"><strong>Note</strong><p>When erasing the value, if you start typing a letter, a drop-down list with a list of possible values will automatically appear.</p></blockquote>

### DASH Manifest Conditioning

The same principles apply for DASH conditioning configuration.

1. Go to the **Dash Conditioning** tab.

2. Select **Add conditioning**.

3. Configure the conditioning (use of **Ad Break Start Detection** event configured previously, with **Splice Insert Out with segmentation descriptor** template).

4. Select **Ok**.

   The following conditioning information is given for configuration:

   - **Splice insert attributes**: similar to HLS, user can define the attribute and the value from a drop-down list and see the result within the ESAM preview.
   - **Segmentation descriptor attributes**: segmentation descriptors from the SCTE-35 can be added in this section, and the result reflected within the ESAM preview.

<blockquote data-callout="note"><strong>Note</strong><p>By default, DASH conditioning will generate an XML structure from the SCTE-35 and encode it in base64 URL (see <a href="/traditional-products-and-appliances/components/manifest-conditioning/manifest-example">conditioned manifest examples</a>). This encoded is indicated as part of the ESAM response using the <code>&lt;Base64Encoding&gt;</code> command attribute.</p></blockquote>

5. You can completely customize the conditioning using the **Expert mode**. When adding conditioning in expert mode, the following will be displayed:

   ![The DASH expert editor shows inline variable suggestions within the ESAM response.](/images/prisma-guide/dash-expert-mode.png)

<blockquote data-callout="note"><strong>Note</strong><p>In this example, the <code>&lt;Base64Encoding&gt;</code> tag has been removed, which will result in XML being transmitted as part of the DASH manifest. XML is not mandatory, you can configure plain text, and associate a value.</p></blockquote>
