updateStream method

Future<void> updateStream({
  1. required String currentVersion,
  2. String? deviceName,
  3. String? mediaType,
  4. String? streamARN,
  5. String? streamName,
})

Updates stream metadata, such as the device name and media type.

You must provide the stream name or the Amazon Resource Name (ARN) of the stream.

To make sure that you have the latest version of the stream before updating it, you can specify the stream version. Kinesis Video Streams assigns a version to each stream. When you update a stream, Kinesis Video Streams assigns a new version number. To get the latest stream version, use the DescribeStream API.

UpdateStream is an asynchronous operation, and takes time to complete.

May throw ClientLimitExceededException. May throw InvalidArgumentException. May throw ResourceNotFoundException. May throw ResourceInUseException. May throw NotAuthorizedException. May throw VersionMismatchException.

Parameter currentVersion : The version of the stream whose metadata you want to update.

Parameter deviceName : The name of the device that is writing to the stream.

Parameter mediaType : The stream's media type. Use MediaType to specify the type of content that the stream contains to the consumers of the stream. For more information about media types, see Media Types. If you choose to specify the MediaType, see Naming Requirements.

To play video on the console, you must specify the correct video type. For example, if the video in the stream is H.264, specify video/h264 as the MediaType.

Parameter streamARN : The ARN of the stream whose metadata you want to update.

Parameter streamName : The name of the stream whose metadata you want to update.

The stream name is an identifier for the stream, and must be unique for each account and region.

Implementation

Future<void> updateStream({
  required String currentVersion,
  String? deviceName,
  String? mediaType,
  String? streamARN,
  String? streamName,
}) async {
  ArgumentError.checkNotNull(currentVersion, 'currentVersion');
  _s.validateStringLength(
    'currentVersion',
    currentVersion,
    1,
    64,
    isRequired: true,
  );
  _s.validateStringLength(
    'deviceName',
    deviceName,
    1,
    128,
  );
  _s.validateStringLength(
    'mediaType',
    mediaType,
    1,
    128,
  );
  _s.validateStringLength(
    'streamARN',
    streamARN,
    1,
    1024,
  );
  _s.validateStringLength(
    'streamName',
    streamName,
    1,
    256,
  );
  final $payload = <String, dynamic>{
    'CurrentVersion': currentVersion,
    if (deviceName != null) 'DeviceName': deviceName,
    if (mediaType != null) 'MediaType': mediaType,
    if (streamARN != null) 'StreamARN': streamARN,
    if (streamName != null) 'StreamName': streamName,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/updateStream',
    exceptionFnMap: _exceptionFns,
  );
}