Unable to make producer for kinesis video stream - amazon-web-services

I am trying to implement producer as mentioned here(https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-java/blob/master/src/main/demo/com/amazonaws/kinesisvideo/demoapp/PutMediaDemo.java).
I have a mkv file which i want to upload in loop to act as producer in Kinesis video stream. But program hangs on line 122 (latch.await()). Program stuck at this line without giving any error and i am not able to see any thing on amazon video preview tab.
What i am doing wrong?

The line 122 (latch.await()) is waiting for acknowledge or connection close event. It could be firewall or network condition causing this to wait for ever…. Before you try your own mkv file, were you able to get the demo running with the sample mkv files and see playback in the console? Let us know if that succeeds in your environment.

Related

Answering machine with Amazon Connect

We are trying to receive customer calls through Amazon Connect and leave messages in Amazon Kinesis.
When we call Amazon Connect from our cell phones, the voice plays the expected message and the Beep tone sounds as expected. But then the call ends and we cannot leave a message. We tried removing Wait and Stop media streaming but the problem persisted. What are we doing wrong?
Set Voice: OK
Play prompt(Message): OK
Play prompt(Beep): OK
Start media streaming: NG
If you have a simple, easy to understand sample for this application, let me know!
Looks like the problem is your Wait block. Wait isn't supported for voice calls, so immediately errors.
Replace the Wait block with a Get Customer Input block. Use Text to speech for the prompt, Set the prompt value manually to <speak></speak> and set Interpret as to SSML. Set it to detect DTMF and set the timeout to however long the message is allowed to be. From your flow above that is 10 seconds.
This should get the customers voice sent to the Kinesis stream and you can process the stream from there.
There is a really thorough implementation guide for voice mail here. I've used this then altered it to suite my exact needs in the past.

AWS Kinesis Video Stream Error "FRAGMENT_TIMECODE_LESSER_THAN_PREVIOUS"

I am trying to stream local mp4 files via Amazon Kinesis Video Streams. But When I try with there Provided Example here its working Fine. But When I try to put my file and try to push its giving me Error on AWS Console Screen
The type of the media is not supported or could not be determined from the media codec ids: (track 1: V_MPEG4/ISO/AVC), (track 2: A_VORBIS).
I tried to convert the File with the provide command here But on the local terminal I am getting Error
onAckEvent AckEvent{ackEventType=ERROR, fragmentTimecode=109963, fragmentNumber='91343852333183234942317985614720708962629140175', errorCode=FRAGMENT_TIMECODE_LESSER_THAN_PREVIOUS, errorId=4004}
Then I tried to add -profile:v baseline in command Still getting the Same Error.
Any Help would be appreciated.

how to stream microphone audio from browser to S3

I want to stream the microphone audio from the web browser to AWS S3.
Got it working
this.recorder = new window.MediaRecorder(...);
this.recorder.addEventListener('dataavailable', (e) => {
this.chunks.push(e.data);
});
and then when user clicks on stop upload the chunks new Blob(this.chunks, { type: 'audio/wav' }) as multiparts to AWS S3.
But the problem is if the recording is 2-3 hours longer then it might take exceptionally longer and user might close the browser before waiting for the recording to complete uploading.
Is there a way we can stream the web audio directly to S3 while it's going on?
Things I tried but can't get a working example:
Kineses video streams, looks like it's only for real time streaming between multiple clients and I have to write my own client which will then save it to S3.
Thought to use kinesis data firehose but couldn't find any client data producer from brower.
Even tried to find any resource using aws lex or aws ivs but I think they are just over engineering for my use case.
Any help will be appreciated.
You can set the timeslice parameter when calling start() on the MediaRecorder. The MediaRecorder will then emit chunks which roughly match the length of the timeslice parameter.
You could upload those chunks using S3's multipart upload feature as you already mentioned.
Please note that you need a library like extendable-media-recorder if you want to record a WAV file since no browser supports that out of the box.

AWS Media Live - handle stream start and stop events

I cannot find any information how to handle the situation like this:
Stream starts: about 3 o'clock.
1.Before the person who is streaming (let's call him a streamer) start to stream I would like to have static image saying something like: 'The event will start soon'.
2.Streamer start pushing his stream to RTMP endpoint but he's late and starts at 3.02. Up until 3.02 the same picture should be visible (as in point 1).
3.Streamer should finish at 4 o'clock but he finishes 5 minutes before 4 (pushing stop at his device).
4.Now, ending screen should be visible from 5 minutes to four and later.
I know that inputs should be switched in order to change a view and this can be scheduled for fixed time, but I would like this to be switched dynamically, ie. when streamer starts pushing to RTMP URL and stops pushing to RTMP URL (from eg. Larix software). How to handle that in AWS Media Live?
Thank you for asking this question on stackoverflow, the easiest way to achieve what you are looking to do is by using an Input Prepare Scheduled Action. The channel will then monitor the input and raise an alarm if the RTMP source is not there. When the RTMP source begins then the alarm will remit, you can send the alarms to a lambda that will look for these alarms and can do the switch from slate MP4 to the RTMP source when it sees the RTMP input missing alarm was cleared. This can also be done for when RTMP input goes away.
Information on Prepare Inputs:
https://docs.aws.amazon.com/medialive/latest/ug/feature-prepare-input.html
Global configuration - Input loss behavior:
https://docs.aws.amazon.com/medialive/latest/ug/creating-a-channel-step3.html
Zach

AWS Kinesis Stream - Lossing Messages

I just had something very strange happen to me with an AWS Kinesis Stream...
I wrote a simple unit test that places a JSON message into an already created stream (the stream was created through the AWS Console). Then my unit test immediately reads that message from the stream. This test process was working for me all last week. I took the weekend off and came back on Monday. Suddenly my unit test stopped working. It could still place the message into the stream but when it tried to read the message out of the stream it found no records inside the stream. No code changes were made at all.
So I deleted the stream through the AWS Console and created a new stream. Told my unit test to use the new stream (that was the only code change done) and everything started working again. So I find this very strange because it's like my original stream just stopped working. The AWS Console said the original stream was still active. Both streams only had one shard.
Does anyone know what could have happened? Is this something that may happen again in the future or is it just a weird anomaly? It makes me very nervous to eventually use this in a production environment if I cannot rely on the AWS Kinesis Stream.