ivsrealtime / Client / start_composition

start_composition#

ivsrealtime.Client.start_composition(**kwargs)#

Starts a Composition from a stage based on the configuration provided in the request.

A Composition is an ephemeral resource that exists after this endpoint returns successfully. Composition stops and the resource is deleted:

  • When StopComposition is called.

  • After a 1-minute timeout, when all participants are disconnected from the stage.

  • After a 1-minute timeout, if there are no participants in the stage when StartComposition is called.

  • When broadcasting to the IVS channel fails and all retries are exhausted.

  • When broadcasting is disconnected and all attempts to reconnect are exhausted.

See also: AWS API Documentation

Request Syntax

response = client.start_composition(
    destinations=[
        {
            'channel': {
                'channelArn': 'string',
                'encoderConfigurationArn': 'string'
            },
            'name': 'string',
            's3': {
                'encoderConfigurationArns': [
                    'string',
                ],
                'recordingConfiguration': {
                    'format': 'HLS'
                },
                'storageConfigurationArn': 'string'
            }
        },
    ],
    idempotencyToken='string',
    layout={
        'grid': {
            'featuredParticipantAttribute': 'string',
            'gridGap': 123,
            'omitStoppedVideo': True|False,
            'videoAspectRatio': 'AUTO'|'VIDEO'|'SQUARE'|'PORTRAIT',
            'videoFillMode': 'FILL'|'COVER'|'CONTAIN'
        },
        'pip': {
            'featuredParticipantAttribute': 'string',
            'gridGap': 123,
            'omitStoppedVideo': True|False,
            'pipBehavior': 'STATIC'|'DYNAMIC',
            'pipHeight': 123,
            'pipOffset': 123,
            'pipParticipantAttribute': 'string',
            'pipPosition': 'TOP_LEFT'|'TOP_RIGHT'|'BOTTOM_LEFT'|'BOTTOM_RIGHT',
            'pipWidth': 123,
            'videoFillMode': 'FILL'|'COVER'|'CONTAIN'
        }
    },
    stageArn='string',
    tags={
        'string': 'string'
    }
)
Parameters:
  • destinations (list) –

    [REQUIRED]

    Array of destination configuration.

    • (dict) –

      Complex data type that defines destination-configuration objects.

      • channel (dict) –

        An IVS channel to be used for broadcasting, for server-side composition. Either a channel or an s3 must be specified.

        • channelArn (string) – [REQUIRED]

          ARN of the channel to use for broadcasting. The channel and stage resources must be in the same AWS account and region. The channel must be offline (not broadcasting).

        • encoderConfigurationArn (string) –

          ARN of the EncoderConfiguration resource. The encoder configuration and stage resources must be in the same AWS account and region.

      • name (string) –

        Name that can be specified to help identify the destination.

      • s3 (dict) –

        An S3 storage configuration to be used for recording video data. Either a channel or an s3 must be specified.

        • encoderConfigurationArns (list) – [REQUIRED]

          ARNs of the EncoderConfiguration resource. The encoder configuration and stage resources must be in the same AWS account and region.

          • (string) –

        • recordingConfiguration (dict) –

          Array of maps, each of the form string:string (key:value). This is an optional customer specification, currently used only to specify the recording format for storing a recording in Amazon S3.

          • format (string) –

            The recording format for storing a recording in Amazon S3.

        • storageConfigurationArn (string) – [REQUIRED]

          ARN of the StorageConfiguration where recorded videos will be stored.

  • idempotencyToken (string) –

    Idempotency token.

    This field is autopopulated if not provided.

  • layout (dict) –

    Layout object to configure composition parameters.

    • grid (dict) –

      Configuration related to grid layout. Default: Grid layout.

      • featuredParticipantAttribute (string) –

        This attribute name identifies the featured slot. A participant with this attribute set to "true" (as a string value) in ParticipantTokenConfiguration is placed in the featured slot.

      • gridGap (integer) –

        Specifies the spacing between participant tiles in pixels. Default: 2.

      • omitStoppedVideo (boolean) –

        Determines whether to omit participants with stopped video in the composition. Default: false.

      • videoAspectRatio (string) –

        Sets the non-featured participant display mode. Default: VIDEO.

      • videoFillMode (string) –

        Defines how video fits within the participant tile. When not set, videoFillMode defaults to COVER fill mode for participants in the grid and to CONTAIN fill mode for featured participants.

    • pip (dict) –

      Configuration related to PiP layout.

      • featuredParticipantAttribute (string) –

        This attribute name identifies the featured slot. A participant with this attribute set to "true" (as a string value) in ParticipantTokenConfiguration is placed in the featured slot.

      • gridGap (integer) –

        Specifies the spacing between participant tiles in pixels. Default: 0.

      • omitStoppedVideo (boolean) –

        Determines whether to omit participants with stopped video in the composition. Default: false.

      • pipBehavior (string) –

        Defines PiP behavior when all participants have left. Default: STATIC.

      • pipHeight (integer) –

        Specifies the height of the PiP window in pixels. When this is not set explicitly, pipHeight’s value will be based on the size of the composition and the aspect ratio of the participant’s video.

      • pipOffset (integer) –

        Sets the PiP window’s offset position in pixels from the closest edges determined by PipPosition. Default: 0.

      • pipParticipantAttribute (string) –

        Identifies the PiP slot. A participant with this attribute set to "true" (as a string value) in ParticipantTokenConfiguration is placed in the PiP slot.

      • pipPosition (string) –

        Determines the corner position of the PiP window. Default: BOTTOM_RIGHT.

      • pipWidth (integer) –

        Specifies the width of the PiP window in pixels. When this is not set explicitly, pipWidth’s value will be based on the size of the composition and the aspect ratio of the participant’s video.

      • videoFillMode (string) –

        Defines how video fits within the participant tile. Default: COVER.

  • stageArn (string) –

    [REQUIRED]

    ARN of the stage to be used for compositing.

  • tags (dict) –

    Tags attached to the resource. Array of maps, each of the form string:string (key:value). See Tagging AWS Resources for details, including restrictions that apply to tags and “Tag naming limits and requirements”; Amazon IVS has no constraints on tags beyond what is documented there.

    • (string) –

      • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'composition': {
        'arn': 'string',
        'destinations': [
            {
                'configuration': {
                    'channel': {
                        'channelArn': 'string',
                        'encoderConfigurationArn': 'string'
                    },
                    'name': 'string',
                    's3': {
                        'encoderConfigurationArns': [
                            'string',
                        ],
                        'recordingConfiguration': {
                            'format': 'HLS'
                        },
                        'storageConfigurationArn': 'string'
                    }
                },
                'detail': {
                    's3': {
                        'recordingPrefix': 'string'
                    }
                },
                'endTime': datetime(2015, 1, 1),
                'id': 'string',
                'startTime': datetime(2015, 1, 1),
                'state': 'STARTING'|'ACTIVE'|'STOPPING'|'RECONNECTING'|'FAILED'|'STOPPED'
            },
        ],
        'endTime': datetime(2015, 1, 1),
        'layout': {
            'grid': {
                'featuredParticipantAttribute': 'string',
                'gridGap': 123,
                'omitStoppedVideo': True|False,
                'videoAspectRatio': 'AUTO'|'VIDEO'|'SQUARE'|'PORTRAIT',
                'videoFillMode': 'FILL'|'COVER'|'CONTAIN'
            },
            'pip': {
                'featuredParticipantAttribute': 'string',
                'gridGap': 123,
                'omitStoppedVideo': True|False,
                'pipBehavior': 'STATIC'|'DYNAMIC',
                'pipHeight': 123,
                'pipOffset': 123,
                'pipParticipantAttribute': 'string',
                'pipPosition': 'TOP_LEFT'|'TOP_RIGHT'|'BOTTOM_LEFT'|'BOTTOM_RIGHT',
                'pipWidth': 123,
                'videoFillMode': 'FILL'|'COVER'|'CONTAIN'
            }
        },
        'stageArn': 'string',
        'startTime': datetime(2015, 1, 1),
        'state': 'STARTING'|'ACTIVE'|'STOPPING'|'FAILED'|'STOPPED',
        'tags': {
            'string': 'string'
        }
    }
}

Response Structure

  • (dict) –

    • composition (dict) –

      The Composition that was created.

      • arn (string) –

        ARN of the Composition resource.

      • destinations (list) –

        Array of Destination objects. A Composition can contain either one destination ( channel or s3) or two (one channel and one s3).

        • (dict) –

          Object specifying the status of a Destination.

          • configuration (dict) –

            Configuration used to create this destination.

            • channel (dict) –

              An IVS channel to be used for broadcasting, for server-side composition. Either a channel or an s3 must be specified.

              • channelArn (string) –

                ARN of the channel to use for broadcasting. The channel and stage resources must be in the same AWS account and region. The channel must be offline (not broadcasting).

              • encoderConfigurationArn (string) –

                ARN of the EncoderConfiguration resource. The encoder configuration and stage resources must be in the same AWS account and region.

            • name (string) –

              Name that can be specified to help identify the destination.

            • s3 (dict) –

              An S3 storage configuration to be used for recording video data. Either a channel or an s3 must be specified.

              • encoderConfigurationArns (list) –

                ARNs of the EncoderConfiguration resource. The encoder configuration and stage resources must be in the same AWS account and region.

                • (string) –

              • recordingConfiguration (dict) –

                Array of maps, each of the form string:string (key:value). This is an optional customer specification, currently used only to specify the recording format for storing a recording in Amazon S3.

                • format (string) –

                  The recording format for storing a recording in Amazon S3.

              • storageConfigurationArn (string) –

                ARN of the StorageConfiguration where recorded videos will be stored.

          • detail (dict) –

            Optional details regarding the status of the destination.

            • s3 (dict) –

              An S3 detail object to return information about the S3 destination.

              • recordingPrefix (string) –

                The S3 bucket prefix under which the recording is stored.

          • endTime (datetime) –

            UTC time of the destination end. This is an ISO 8601 timestamp; note that this is returned as a string.

          • id (string) –

            Unique identifier for this destination, assigned by IVS.

          • startTime (datetime) –

            UTC time of the destination start. This is an ISO 8601 timestamp; note that this is returned as a string.

          • state (string) –

            State of the Composition Destination.

      • endTime (datetime) –

        UTC time of the Composition end. This is an ISO 8601 timestamp; note that this is returned as a string.

      • layout (dict) –

        Layout object to configure composition parameters.

        • grid (dict) –

          Configuration related to grid layout. Default: Grid layout.

          • featuredParticipantAttribute (string) –

            This attribute name identifies the featured slot. A participant with this attribute set to "true" (as a string value) in ParticipantTokenConfiguration is placed in the featured slot.

          • gridGap (integer) –

            Specifies the spacing between participant tiles in pixels. Default: 2.

          • omitStoppedVideo (boolean) –

            Determines whether to omit participants with stopped video in the composition. Default: false.

          • videoAspectRatio (string) –

            Sets the non-featured participant display mode. Default: VIDEO.

          • videoFillMode (string) –

            Defines how video fits within the participant tile. When not set, videoFillMode defaults to COVER fill mode for participants in the grid and to CONTAIN fill mode for featured participants.

        • pip (dict) –

          Configuration related to PiP layout.

          • featuredParticipantAttribute (string) –

            This attribute name identifies the featured slot. A participant with this attribute set to "true" (as a string value) in ParticipantTokenConfiguration is placed in the featured slot.

          • gridGap (integer) –

            Specifies the spacing between participant tiles in pixels. Default: 0.

          • omitStoppedVideo (boolean) –

            Determines whether to omit participants with stopped video in the composition. Default: false.

          • pipBehavior (string) –

            Defines PiP behavior when all participants have left. Default: STATIC.

          • pipHeight (integer) –

            Specifies the height of the PiP window in pixels. When this is not set explicitly, pipHeight’s value will be based on the size of the composition and the aspect ratio of the participant’s video.

          • pipOffset (integer) –

            Sets the PiP window’s offset position in pixels from the closest edges determined by PipPosition. Default: 0.

          • pipParticipantAttribute (string) –

            Identifies the PiP slot. A participant with this attribute set to "true" (as a string value) in ParticipantTokenConfiguration is placed in the PiP slot.

          • pipPosition (string) –

            Determines the corner position of the PiP window. Default: BOTTOM_RIGHT.

          • pipWidth (integer) –

            Specifies the width of the PiP window in pixels. When this is not set explicitly, pipWidth’s value will be based on the size of the composition and the aspect ratio of the participant’s video.

          • videoFillMode (string) –

            Defines how video fits within the participant tile. Default: COVER.

      • stageArn (string) –

        ARN of the stage used as input

      • startTime (datetime) –

        UTC time of the Composition start. This is an ISO 8601 timestamp; note that this is returned as a string.

      • state (string) –

        State of the Composition.

      • tags (dict) –

        Tags attached to the resource. Array of maps, each of the form string:string (key:value). See Tagging AWS Resources for details, including restrictions that apply to tags and “Tag naming limits and requirements”; Amazon IVS has no constraints on tags beyond what is documented there.

        • (string) –

          • (string) –

Exceptions