

# Virtual input switching
<a name="feature-vips"></a>

With the virtual input switching feature, you can set up a POIS to control switching from one AWS Elemental Live input to another. You can also switch inputs using dynamic input switching using the REST API. For more information, see [Dynamic input switching](dynamic-content-switching.md).

**Topics**
+ [About virtual input switching](vips-about.md)
+ [How virtual input switching works](vips-about-how.md)
+ [Setting up for virtual input switching](vips-setup.md)

# About virtual input switching
<a name="vips-about"></a>

## Supported version of the specification
<a name="vips-about-spec"></a>

Elemental Live supports communications with a POIS according to this specification: OpenCable Specifications Alternate Content Real-time Event Signaling and Management API, OC-SP-ESAM-API-I03-131025.

## The two virtual input switching features
<a name="vips-about-options"></a>

There are two virtual input switching features. These features work in different ways and support different use cases. But they both require a POIS.
+ Virtual input switching using asynchronous ESAM messages

  This type of input switching is based only on decisions from the POIS. We also refer to this switching as asynchronous input switching. This feature is available in Elemental Live version 2.23.0 and later.
+ Virtual input switching using SCTE-35 messages

  This type of input switching relies on switch-related SCTE-35 messages that are in the input. We also refer to this switching as SCTE-35-triggered input switching. This feature is available in Elemental Live version 2.20.2 and later.

Virtual input switching requires the virtual input switcher license (the Virtual Input Switcher License add-on pack). Contact your AWS sales manager. 

## Choosing the switching feature to use
<a name="vips-about-options-choosing"></a>

Typical use cases for the virtual input switching features are the following:
+ SCTE-35-triggered input switching alone

  When your event consists of live MPTS programs, you can implement SCTE-35-triggered input switching. Upstream of Elemental Live, a system inserts SCTE-35 messages into the programs, and Elemental Live reacts to them during ingest.

  This scenario works well when you have well-orchestrated, predictable event.
+ Asynchronous input switching alone

  When it's not feasible to implement SCTE-35-triggered input switching, you can implement asynchronous input switching. For example, if your event doesn't use sources that support SCTE-35-triggered input switching.

  With asynchronous input switching, the POIS sends SCTE-35 messages to Elemental Live. These messages contain instructions that Elemental Live reacts to. 

  Asynchronous input switching doesn't mean that the switching is unplanned. You can design a schedule and automate your POIS to send the switch requests.
+ Both types of switching

  You might implement the SCTE-35-triggered switch scenario described previously, and also implement asynchronous input switching. To handle planned cutaways to file content, you can implement asynchronous input switching to handle unplanned cutaways to a file content. You can also implement synchronous input switching when you need to quickly drop the live stream and show a "please standby" file clip.

# How virtual input switching works
<a name="vips-about-how"></a>

**Topics**
+ [Virtual input switching using asynchronous ESAM messages](vips-asynch.md)
+ [Virtual input switching using SCTE-35 messages](vips-s35.md)

# Virtual input switching using asynchronous ESAM messages
<a name="vips-asynch"></a>

## Input types
<a name="vips-asynch-inputs"></a>

Asynchronous input switching works only with the following sources:
+ MPTS programs, from an MPTS input. MPTS programs are typically live sources.
+ File inputs—any type of input that Elemental Live considers to be a file input. See [Supported upstream systems for file inputs](supported-inputs-file-types.md)

If your event doesn't include these types of inputs, you can't set up for asynchronous input switching.

## Setup
<a name="vips-asynch-setup"></a>

You set up the inputs in the Elemental Live event. You also set up the POIS with information about the same set of inputs. In other words, the inputs must be set up in both Elemental Live and the POIS.

You start the event. At any time, the POIS can send an asynchronous ESAM request to Elemental Live. 

## Principle of operation
<a name="vips-asynch-operation"></a>

The POIS sends a request to Elemental Live to request a switch away from the currently active input and to another input. The request can be seen as a switch away to another input. In addition, the originator of any potential action is the POIS.

Compare this principle of operation to SCTE-35-based triggers, where Elemental Live probes each non-active input for requests to switch to that non-active input. The request can be seen as a switch to this input. In addition, the originator of any potential action is Elemental Live. 

## Types of requests
<a name="vips-asynch-types"></a>

The POIS can send one or more of the following requests:
+ Prepare input. This request makes Elemental Live start processing the input before you switch to it. This preparation reduces the delay that always occurs between the switch request and the switch happening.
+ Switch input. The POIS sends this request to instruct Elemental Live to switch, either immediately, or at a specific time.
+ Handles SCTE-35 messages for ad avails. The POIS can request that Elemental Live insert an ad avail message. For information about the handling of these types of SCTE-35 messages, see [POIS conditioning](pois-conditioning.md).
+ SCTE-35 messages that instruct Elemental Live whether to include the SCTE-35 in the output or not. The POIS can choose to instruct Elemental Live to include or to remove any of the three types of SCTE-35 messages. 

## Timing of input switching requests
<a name="vips-asynch-timing"></a>

The prepare input request should be sent at least 15 seconds before the switch request.

If the POIS sends both a prepare request and a switch request, the switch will occur in less than 4 seconds. After the switch occurs, Elemental Live stops preparing the input.

If the POIS sends a switch request but no prepare request, the input switch might take as long as 12 seconds. 

## Result in outputs
<a name="vips-asynch-results"></a>

If the POIS instructs Elemental Live to include an SCTE-35 message in the output, that message becomes part of the stream. This rule applies to all types of messages – prepare input, switch input, and message relating to ad avails.

For a prepare input or switch input, Elemental Live still performs the action (prepare or switch), even if the POIS instructs Elemental Live not to include the message itself in the output.

Elemental Live includes these messages in output types that support SCTE-35 messages. For example, Elemental Live includes the messages in an HLS output.

For detailed information about how Elemental Live handles ad avail SCTE-35 messages, see [POIS conditioning](pois-conditioning.md). 

## No queuing of requests
<a name="vips-asynch-no-queue"></a>

There is no way to create a queue of requests. Elemental Live can handle only one request. The POIS might send a request to switch to input A at 2:00:00.00. Then, before Elemental Live has performed that request, the POIS might send a request to switch to input B. 

Even if the second request has a start time that is later than the first request, the second request will replace the first request in the request list.

## Example
<a name="vips-asynch-example"></a>

Here's an example of an input switching scenario that illustrates the different input switching capabilities.

The time is 2:00:00. You start the event and Elemental Live starts ingesting the first input, which is a file input. 

**Asynchronous request to a file input**

At 2:01:00, the POIS sends an asynchronous request to switch to input B. Input B is the first in a series of 20-second ads. 

**Asynchronous request to switch to a live input**

At 2:02:07, while these files are being processed, the POIS sends an asynchronous request to switch to input Y at 2:04:00.00. Elemental Live switches to input Y at the specified start time. Assume that input Y is a live TS input.

**Canceled asynchronous request**

This example shows cancellation of an asynchronous request.

At 2:51:44, the POIS sends a request to switch to input F at 2:52:00.

At 2:51:47, the POIS sends a request to switch to input Y (the input that is currently active) at 2:49:60.00. This request effectively cancels the switch to input F. Elemental Live can only have one request in its buffer, and the most recently received request always replaces any request already waiting.

**Multiple requests in an unexpected order**

At 2:53:48, the POIS sends a request to switch to input D at 2:57:00.

At 2:54:00, the POIS sends a request to switch to input E at 2:55:30. 

Elemental Live ignores the request to switch to input D. Elemental Live can only have one request in its buffer, and the most recently received request always replaces any request already waiting.

Therefore at 2:55:30, Elemental Live switches to input E. 

# Virtual input switching using SCTE-35 messages
<a name="vips-s35"></a>

This type of input switching works with SCTE-35 messages that are in a transport stream source. When Elemental Live encounters an SCTE 35 message in the source, it sends the message to the POIS. The POIS might decide to send a request to switch input. Note that there is no sense of a particular type of SCTE 35 message that can trigger an input switch request. The POIS can request a switch in response to any type of SCTE 35 message that it receives.

## Input types
<a name="vips-s35-inputs"></a>

SCTE-35-triggered input switching works only with the following sources:
+ MPTS programs, from one MPTS input. MPTS programs are typically live sources.

## Principle of operation
<a name="vips-s35-operation"></a>

Elemental Live probes each non-active MPTS program for requests to switch to that non-active input. The request can be seen as a switch to this input. In addition, the originator of any potential action is Elemental Live.

Compare this principle of operation to asynchronous input switching, where the POIS sends a request to Elemental Live to request a switch away from the currently active input and to another input. The request can be seen as a switch away to another input. In addition, the originator of any potential action is the POIS. 

## Setup
<a name="vips-s35-setup"></a>

In the event, you set up the inputs:
+ You identify all the MPTS programs that you want to use, and set up each program as an individual input.

You also set up the POIS with information about the same set of inputs. In other words, the inputs must be set up in both Elemental Live and the POIS.

You start the event. As Elemental Live ingests the first input, it encounters SCTE-35 messages. It sends these messages to the POIS. It sends all SCTE-35 messages, not only switching-related messages. For example, it also sends ad avail messages.

For any switching-related message, the POIS might decide to send a request to Elemental Live to switch to another input at a specific time. The POIS can send this instruction at any time. There is no timeout between receiving the information and sending an instruction. The POIS might also decide not to send an instruction. 

## Types of requests
<a name="vips-s35-types"></a>

The following are the types of requests:
+ Prepare input. This request makes Elemental Live start processing the input, even before the input is active. This preparation reduces the delay that always occurs between the switch request and the switch happening.
+ Switch input. The POIS sends this request to instruct Elemental Live to switch, either immediately, or at a specific time.

  The prepare input request should be sent at least 15 seconds before the switch request.

  If the POIS sends a prepare input and a switch input, the switch will occur in less than 4 seconds.

  If the POIS doesn't send a prepare input, the input switch can take as long as 12 seconds.
+ SCTE-35 messages for ad avail handling. The POIS can request that Elemental Live insert an ad avail message, or delete or modify an ad avail message that is in the source stream (and that Elemental Live therefore sent to the POIS). For information about the handling of these types of SCTE-35 messages, see [POIS conditioning](pois-conditioning.md).
+ SCTE-35 messages that instruct Elemental Live whether to include the SCTE-35 in the output or not. The POIS can choose to instruct Elemental Live to include or to remove any of the three types of SCTE-35 messages. 

## Timing of input switching requests
<a name="vips-s35-timing"></a>

The prepare input request should be sent at least 15 seconds before the switch request.

If the POIS sends a prepare input and a switch input, the switch will occur in less than 4 seconds. After the switch occurs, Elemental Live stops preparing the input.

If the POIS doesn't send a prepare input, the input switch might take as long as 12 seconds.

## Result in outputs
<a name="vips-s35-results"></a>

If the POIS instructs Elemental Live to include an SCTE-35 message in the output, that message becomes part of the stream. This rule applies to all types of messages – prepare input, switch input, and messages relating to ad avails.

For a prepare input or switch input, Elemental Live still performs the action (prepare or switch), even if the POIS instructs Elemental Live not to include the message itself in the output.

Elemental Live includes these messages in output types that support SCTE-35 messages. For example, Elemental Live includes the messages in an HLS output.

For detailed information about how Elemental Live handles ad avail SCTE-35 messages, see [POIS conditioning](pois-conditioning.md). 

## Example
<a name="vips-s35-example"></a>

Here's an example of an input switching scenario that illustrates the different input switching capabilities.

The time is 2:00:00. You start the event and Elemental Live starts ingesting the first input. At the same time, Elemental Live reads all the other inputs, 

**SCTE-35-triggered request**

At 2:17:33, while ingesting input Y, Elemental Live encounters an SCTE-35 message. It sends the message to the POIS. Shortly after, the POIS sends a request to switch to input Z at 2:30:00. 

At 2:30:00, Elemental Live switches to input Z (another live input).

**SCTE-35 message that the POIS ignores**

At 2:37:00, Elemental Live encounters an SCTE-35 message. It sends the message to the POIS, but the POIS doesn't send an input switch request. There is no rule that dictates that the POIS must switch on receiving a message.

**Multiple SCTE-35-triggered requests**

At 2:40:02, Elemental Live encounters another SCTE-35 message, and this time the POIS does respond by sending two requests. One request is to switch at 2:45:13 to input B (one of the ads that played previously). The second request is to switch at 2:45:43 back to input Z.

At 2:45:13, Elemental Live switches to input B.

At 2:45:43, Elemental Live switches back to input Z.

**Canceled asynchronous request**

At 2:51:44, the POIS sends a request to switch to input F at 2:52:00.

At 2:51:47, the POIS sends a request to cancel the switch to input F.

This example shows cancellation of an asynchronous request. The POIS can cancel either an asynchronous request of a SCTE-35-triggered request.

**Multiple requests in an unexpected order**

At 2:53:48, the POIS sends a request to switch to input D at 2:57:00.

At 2:54:00, the POIS sends a request to switch to input E at 2:55:30. 

At 2:55:30, Elemental Live switches to input E. Then at 2:57:00, Elemental Live switches to input D.

Note that Elemental Live doesn't ignore the request to switch to input D, even though it received the request for input E in the meantime. 

# Setting up for virtual input switching
<a name="vips-setup"></a>

With virtual input switching, the Elemental Live event and the POIS must be set up with identical information. 

The setup steps are the same for asynchronous input switching and SCTE-35-triggered input switching.

**Topics**
+ [Overview](vips-setup-overview.md)
+ [Step 1: Coordinate with the POIS operator](vips-setup-step-coordinate.md)
+ [Step 2: Set up the event](vips-setup-step-event.md)
+ [Step 3: Set up the inputs in the event](vips-setup-step-inputs.md)
+ [Step 4: Start the event](vips-setup-step-start.md)

# Overview
<a name="vips-setup-overview"></a>

The POIS must be set up with the following information:
+ A tag for the Elemental Live input. Each input must be unique in the Elemental Live event.
+ The acquisition point ID and zone for the Elemental Live event.

 In Elemental Live, you set up the event with the following information:
+ Acquisition point ID. This ID is how the POIS identifies the Elemental Live node. The POIS provides you with this ID.
+ Zone. This ID is how the POIS identifies the specific event. The POIS provides you with this ID.
+ These two fields set up Elemental Live and the POIS to have a common identifier for the event.

In the event, you set up the inputs with the following information:
+ Input ID. This is the standard ID that Elemental Live generates and assigns when you save an event.
+ The URL for the input.
+ Label. This tag has the same value as the label (in Elemental Live). In this way, both Elemental Live and the POIS have a common identifier for each input.
+ A virtual tag. This identifies the input as one that the POIS knows about. Typically, you set up all the inputs in an event as virtual. 

## Number of nodes and number of POIS
<a name="vips-setup-limits"></a>
+ Each Elemental Live node can communicate with only one POIS. All the events on the Elemental Live node must be configured for the same POIS.
+ One POIS can communicate with several Elemental Live nodes. The POIS uses the POIS AcquisitionPointID and ZoneID parameter to uniquely identify each Elemental Live node.

## Number and type of inputs
<a name="vips-setup-inputs-limits"></a>

With asynchronous input switching, the inputs can be any of the following:
+ Programs in one MPTS. You can set up a maximum of 11 programs.
+ Any type of input that Elemental Live considers to be a file input. See [Supported upstream systems for file inputs](supported-inputs-file-types.md). 

  There is no limit to the number of inputs of this type.

With SCTE-35-triggered input switching, the inputs can be any of the following:
+ Programs in one MPTS. You can set up a maximum of 11 programs.

# Step 1: Coordinate with the POIS operator
<a name="vips-setup-step-coordinate"></a>

Talk to the POIS operator, and agree on the values for this data:
+ The label for each input. This value must be identical, and it is case sensitive.
+ The acquisition ID for the Elemental Live node. The POIS must have a different acquisition ID for each Elemental Live node that it works with.
+ The zone ID for the specific event. 

  The combination of acquisition ID and zone ID must be unique in the Elemental Live event.
+ The URL for the signal conditioner endpoint on the POIS. This endpoint handles the input switching communications with Elemental Live.
+ The URL for the alternate signal conditioner endpoint on the POIS, if this exists.
+ The preroll that is the number of seconds between when Elemental Live receives the request from the POIS and when Elemental Live inserts any SCTE-35 messages in the content. This preroll isn't required if the messages that the POIS sends include a start time for the input switch,

Make a note of all of this data. You will need it to set up on Elemental Live. 

# Step 2: Set up the event
<a name="vips-setup-step-event"></a>

These steps show you how to configure the event with information about the POIS server.

The information in this section assumes that you are familiar with the general steps for creating an event. 

**Note**  
The information in this section assumes that you are familiar with the general steps for creating an event. 

1. On the web interface, open the **Ad Avail Controls** section of the event.

1. Complete the fields as follows:
   + **Ad Avail Trigger**: ESAM.
   + **Acquisition Point Identifier**: The value that you [obtained from the POIS operator](vips-setup-step-coordinate.md).
   + **Zone Identity**: The value that you obtained from the POIS operator.
   + **Signal Conditioner Endpoint**: The URL that you obtained from the POIS operator.
   + **Alternate Signal Conditioner Endpoint**: The URL that you obtained from the POIS operator, if any.
   + **Response Signal Preroll**: The value you obtained from the POIS operator, if any. 
   + Other fields: The other fields in this section aren't used for virtual input switching.

1. Complete this field only if you want to enable asynchronous input switching:
   + **Unsolicited ESAM Server**. 

# Step 3: Set up the inputs in the event
<a name="vips-setup-step-inputs"></a>

**To set up an MPTS program**

You must set up each program in the MPTS as an individual input. 

You can use inputs from an MPTS with both asynchronous input switching and SCTE-35-triggered input switching.
**Note**  
The information in this section assumes that you are familiar with the general steps for creating an event. 

1. On the web interface, got to the **Inputs** section of the event.

1. Complete the **Input** section as follows:
   + **Input Type**: Choose Network Input.
   + **Input Name**: Enter the label for the input, obtained from the POIS operator.
   + **Network Location**: The URL of the MPTS. For example, udp://192.20.08.18:5001

1. Open the **Advanced** section of this input and complete the following fields (on the first line of fields)
   + **Virtual Input**: Choose this field to set up the input as a virtual input. Elemental Live notifies the POIS only about inputs that are configured as virtual inputs.
   + **Virtual Input SCTE 35 PID**: Enter the PID in the MPTS that holds the SCTE-35 data stream. You complete this field only if you are using this program with SCTE-35-triggered input switching. This is the PID that Elemental Live probes for SCTE-35 messages to send to the POIS.

1. Go to the **Video Selector** section of this input and complete the following fields:
   + **Program**, in **Video Selector**: Enter the program number of the individual program in the mpts.

1. Set up the audio and captions for this MPTS in the usual way.

1. Set up more inputs, for other programs in the MPTS. For all the inputs, these rules apply:
   + The URLs must be identical, because the programs must all be in the same MPTS.
   + The Input names must each be different.
   + The Program (in the Video Selector) must each be different.

**To set up a file input**

You can use file inputs with asynchronous input switching. You can't use them with SCTE-35-triggered input switching.
**Note**  
The information in this section assumes that you are familiar with the general steps for creating an event. 

1. On the web interface, got to the **Inputs** section of the event.

1. Complete the **Input** section as follows:
   + **Input Type**: Choose File Input or HLS File Input.
   + **Input Name**: Enter the label for the input, obtained from the POIS operator.
   + **File Location**: The path and file name for the source. For example, ftp://vod\$1files/mlaw.wav

1. Open the **Advanced** section of this input and complete the fields as follows:
   + **Virtual Input**: Choose this field to set up the input as a virtual input. Elemental Live notifies the POIS only about inputs that are configured as virtual inputs.
   + **Virtual Input SCTE 35 PID**: Ignore this field. It is used only with SCTE-35-triggered input switching. 

# Step 4: Start the event
<a name="vips-setup-step-start"></a>

When you start the event, Elemental Live ingests inputs, starting with the first input listed in the event. While the event is running, Elemental Live responds to POIS requests to switch to a different input. The role of Elemental Live is reactive. The POIS controls input switching. 