Función Createproducer; Función Deeplens_Kinesis_Video.cReateproducer - AWS DeepLens Guia

Tabla de contenido

Publicidad

# Stream configuration, name and retention
# Note that the name will appear as deeplens-myStream
stream_name = 'myStream'
retention = 2 #hours
# Amount of time to stream
wait_time = 60 * 60 * 5 #seconds
# Use the boto session API to grab credentials
session = Session()
creds = session.get_credentials()
# Create producer and stream.
producer = dkv.createProducer(creds.access_key, creds.secret_key, creds.token, "us-
east-1")
client.publish(topic=iot_topic, payload="Producer created")
kvs_stream = producer.createStream(stream_name, retention)
client.publish(topic=iot_topic, payload="Stream {} created".format(stream_name))
# Start putting data into the KVS stream
kvs_stream.start()
client.publish(topic=iot_topic, payload="Stream started")
time.sleep(wait_time)
# Stop putting data into the KVS stream
kvs_stream.stop()
client.publish(topic=iot_topic, payload="Stream stopped")
# Execute the function above
greengrass_hello_world_run()
En este ejemplo, llamamos adkv.createProducerpara crear instancias del cliente del SDK del
productor de Kinesis Video Streams. A continuación, llamamos a producer.createStream para
configurar el streaming desde el dispositivo AWS DeepLens. Controlamos la longitud de las transmisiones
de vídeo llamando a my_stream.start, time.sleep y my_stream.stop. El vídeo almacenado se
conserva en Kinesis Video Streams durante dos horas, ya que configuramos laretentionParámetro a2.
Temas
Función DeepLens_Kinesis_Video.createProducer (p. 159)
Objeto Producer (p. 160)
Objeto Stream (p. 161)
Función DeepLens_Kinesis_Video.createProducer
Crea una instancia del objeto de cliente del SDK de Kinesis Video Streams Producer paraAWS DeepLens.
Utilice la instancia para conectar suAWS DeepLensDevice a laAWSEn la nube y para administrar
secuencias de vídeo desde el dispositivo a Kinesis Video Streams.
Sintaxis
import DeepLens_Kinesis_Video as dkv
producer = dkv.createProducer(aws_access_key, aws_seccrete_key, session_token, aws_region)
Parámetros
• aws_access_key
AWS DeepLens Guía para desarrolladores
Función createProducer
159

Publicidad

Tabla de contenido
loading

Tabla de contenido