FailoverCondition

class aws_cdk.aws_medialive_alpha.FailoverCondition

Bases: object

(experimental) A condition that, when met on the active input, triggers automatic input failover to the secondary input.

Create conditions with the static factory methods.

Stability:

experimental

ExampleMetadata:

infused

Example:

# stack: Stack
# primary_input: medialive.IInput
# secondary_input: medialive.IInput
# audio_selector: medialive.AudioSelector
# video: medialive.EncodeConfiguration
# audio: medialive.EncodeConfiguration
# bucket: s3.IBucket


medialive.Channel(stack, "Channel",
    inputs=[medialive.InputAttachment(
        input=primary_input,
        automatic_input_failover=medialive.AutomaticInputFailover(
            secondary_input=secondary_input,
            input_preference=medialive.InputPreference.PRIMARY_INPUT_PREFERRED,
            error_clear_time=Duration.seconds(3),
            failover_conditions=[
                medialive.FailoverCondition.input_loss(threshold=Duration.millis(1500)),
                medialive.FailoverCondition.audio_silence(audio_selector=audio_selector, threshold=Duration.seconds(2)),
                medialive.FailoverCondition.video_black(black_detect_threshold=0.1, threshold=Duration.seconds(1))
            ]
        )
    ), medialive.InputAttachment(
        # The secondary input must also be attached to the channel as its own input.
        input=secondary_input
    )],
    output_groups=[
        medialive.OutputGroupConfiguration.hls(
            name="hls",
            destinations=[medialive.OutputDestination.to_bucket(bucket, "live/stream")],
            outputs=[medialive.HlsOutputDefinition(encodes=[video, audio], output_name="hls_out")]
        )
    ]
)
Stability:

experimental

Static Methods

classmethod audio_silence(*, audio_selector, threshold=None)

(experimental) Fail over when the monitored audio selector is silent for the threshold period.

Parameters:
  • audio_selector (AudioSelector) – (experimental) The audio selector (defined on the input attachment) that MediaLive monitors for silence. Pass the same AudioSelector instance you put in the attachment’s audioSelectors — select your most important rendition.

  • threshold (Optional[Duration]) – (experimental) How long the audio must be silent (audio loss, or quieter than -50 dBFS) before failover occurs. Default: - MediaLive service default

Stability:

experimental

Return type:

FailoverCondition

classmethod input_loss(*, threshold=None)

(experimental) Fail over when no input is detected for the threshold period.

Parameters:

threshold (Optional[Duration]) – (experimental) The amount of time with no input detected before failover occurs. Default: - MediaLive service default

Stability:

experimental

Return type:

FailoverCondition

classmethod video_black(*, black_detect_threshold=None, threshold=None)

(experimental) Fail over when the content is black for the threshold period.

Parameters:
  • black_detect_threshold (Union[int, float, None]) – (experimental) The fraction of white (0.0–1.0) below which a pixel is considered black. Every pixel in a frame must be below this threshold for the frame to count as black. For example, 0.1 means 10% white (90% black). Default: - MediaLive service default

  • threshold (Optional[Duration]) – (experimental) How long the content must be black before failover occurs. Default: - MediaLive service default

Stability:

experimental

Return type:

FailoverCondition