createChannel method

Future<CreateChannelResponse> createChannel({
  1. required String channelGroupName,
  2. required String channelName,
  3. String? clientToken,
  4. String? description,
  5. InputSwitchConfiguration? inputSwitchConfiguration,
  6. InputType? inputType,
  7. OutputHeaderConfiguration? outputHeaderConfiguration,
  8. Map<String, String>? tags,
})

Create a channel to start receiving content streams. The channel represents the input to MediaPackage for incoming live content from an encoder such as AWS Elemental MediaLive. The channel receives content, and after packaging it, outputs it through an origin endpoint to downstream devices (such as video players or CDNs) that request the content. You can create only one channel with each request. We recommend that you spread out channels between channel groups, such as putting redundant channels in the same AWS Region in different channel groups.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter channelGroupName : The name that describes the channel group. The name is the primary identifier for the channel group, and must be unique for your account in the AWS Region.

Parameter channelName : The name that describes the channel. The name is the primary identifier for the channel, and must be unique for your account in the AWS Region and channel group. You can't change the name after you create the channel.

Parameter clientToken : A unique, case-sensitive token that you provide to ensure the idempotency of the request.

Parameter description : Enter any descriptive text that helps you to identify the channel.

Parameter inputSwitchConfiguration : The configuration for input switching based on the media quality confidence score (MQCS) as provided from AWS Elemental MediaLive. This setting is valid only when InputType is CMAF.

Parameter inputType : The input type will be an immutable field which will be used to define whether the channel will allow CMAF ingest or HLS ingest. If unprovided, it will default to HLS to preserve current behavior.

The allowed values are:

  • HLS - The HLS streaming specification (which defines M3U8 manifests and TS segments).
  • CMAF - The DASH-IF CMAF Ingest specification (which defines CMAF segments with optional DASH manifests).

Parameter outputHeaderConfiguration : The settings for what common media server data (CMSD) headers AWS Elemental MediaPackage includes in responses to the CDN. This setting is valid only when InputType is CMAF.

Parameter tags : A comma-separated list of tag key:value pairs that you define. For example:

"Key1": "Value1",

"Key2": "Value2"

Implementation

Future<CreateChannelResponse> createChannel({
  required String channelGroupName,
  required String channelName,
  String? clientToken,
  String? description,
  InputSwitchConfiguration? inputSwitchConfiguration,
  InputType? inputType,
  OutputHeaderConfiguration? outputHeaderConfiguration,
  Map<String, String>? tags,
}) async {
  final headers = <String, String>{
    if (clientToken != null) 'x-amzn-client-token': clientToken.toString(),
  };
  final $payload = <String, dynamic>{
    'ChannelName': channelName,
    if (description != null) 'Description': description,
    if (inputSwitchConfiguration != null)
      'InputSwitchConfiguration': inputSwitchConfiguration,
    if (inputType != null) 'InputType': inputType.value,
    if (outputHeaderConfiguration != null)
      'OutputHeaderConfiguration': outputHeaderConfiguration,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/channelGroup/${Uri.encodeComponent(channelGroupName)}/channel',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return CreateChannelResponse.fromJson(response);
}