J28
J28

Reputation: 1110

Javascript aws-sdk | how to send a video to kinesis stream

what am i doing wrong below for the Type Error? and how should i write the video stream to endpoint in the below code:

I have the below code

successCallback(stream){

    AWS.config.region = 'us-east-1'; // Region
    AWS.config.credentials = new AWS.CognitoIdentityCredentials({
        IdentityPoolId: 'xxxxxxxxxxx',
    });
    AWS.config.apiVersions = {
      kinesisvideo:'2017-09-30'
    }


    var kinesisvideo = new AWS.KinesisVideo();
    //Get stream
    var params = {
      APIName: "PUT_MEDIA",
      StreamName: this.KINESIS_STREAM_NAME
    };


    kinesisvideo.getDataEndpoint(params,function(err,data){
        if(err)
          console.log(err,err.stack);
        else{
          console.log("Kinesis Stream Response ---------");
          console.log(data);
         // data.DataEndpoint
         //How should i send the stream to endpoint?
        }
    });

  }

I am getting an error

TypeError AWS.KinesisVideo is not a constructor

at

var kinesisvideo = new AWS.KinesisVideo();

Also, once i get the video stream end point, how should i write my data to the endpoint? There is no documentation provided on the same in aws docs.

Thanks.

Upvotes: 1

Views: 531

Answers (1)

Kanishk Gupta
Kanishk Gupta

Reputation: 31

As per your description, I think you are using default JavaScript SDK provided which does not contain kinesis video.

You can override this default and easily build your own custom version of the SDK: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/browser-building.html

Upvotes: 2

Related Questions