Notifications in Amazon Kinesis Video Streams
When a media fragment is available for consumption, Kinesis Video Streams notifies customers using Amazon Simple Notification Service (Amazon SNS) notifications. The following topic explains how to get started with notifications.
UpdateNotificationConfiguration
Use this API operation to update the notification information for a stream. For more
information about the UpdateNotificationConfiguration
feature, see UpdateNotificationConfiguration in the
Amazon Kinesis Video Streams Developer Guide.
It takes at least 1 minute to initiate the notification after updating the
notification configuration. Wait at least 1 minute before invoking
PutMedia
after the update call.
Amazon SNS Topic Payload
Any notification initiated through the previous workflow will deliver the Amazon SNS topic payload, as shown in the following example. This example is an Amazon SNS message that occurs after consuming notification data from an Amazon Simple Queue Service (Amazon SQS) queue.
{ "Type" : "Notification", "MessageId" :
Message ID
, "TopicArn" :,SNS ARN "Subject" : "Kinesis Video Streams Notification", "Message" : "{\"StreamArn\":\
Stream Arn
,\"FragmentNumber\":\Fragment Number
,\"FragmentStartProducerTimestamp\":FragmentStartProducerTimestamp
, \"FragmentStartServerTimestamp\":FragmentStartServerTimestamp
,\"NotificationType\":\"PERSISTED\",\"NotificationPayload\":{\CUSTOM_KEY_1
:\CUSTOM_VALUE_1
, \CUSTOM_KEY_2
:\CUSTOM_VALUE_2
}}", "Timestamp" : "2022-04-25T18:36:29.194Z", "SignatureVersion" :Signature Version
, "Signature" :Signature
, "SigningCertURL" :Signing Cert URL
, "UnsubscribeURL" :Unsubscribe URL
}
Subject: "Kinesis Video Streams Notification" Message: { "StreamArn":
Stream Arn
, "FragmentNumber":Fragment Number
, "FragmentStartProducerTimestamp":Fragment Start Producer Timestamp
, "FragmentStartServerTimestamp":Fragment Start Server Timestamp
, "NotificationType":"PERSISTED", "NotificationPayload":{CUSTOM_KEY_1
:CUSTOM_VALUE_1
,CUSTOM_KEY_2
:CUSTOM_VALUE_2
} }
Viewing your Amazon SNS Messages
You cannot read messages directly from an Amazon SNS topic, because there is no API for doing so. You can view the messages sent to your Amazon SNS topic, or choose any Amazon SNS supported destination. However, the most efficient option for viewing messages is to use Amazon SQS.
To view your Amazon SNS messages using Amazon SQS
-
Create an Amazon SQS queue.
-
From the AWS Management Console, open the Amazon SNS topic set as a destination under
NotificationConfiguration
. -
Choose Create Subscription, and then choose the Amazon SQS queue created in Amazon Simple Storage Service (Amazon S3).
-
Run a
PutMedia
session with Notifications enabled and with Notification tags, and then choose the Amazon SQS queue in the Amazon SQS console. -
Select Send and receive messages for the Amazon SQS topic.
-
Poll for messages. This command should show all notifications generated by the
PutMedia
session