Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
Migrating aws-sdk js v2 to v3 Problems with getHLSStreamingSessionURLCommand

I'm trying to migrate the code of the v2 to v3 but I having problems to find how to migrate this line:

kinesisVideoArchivedContent.endpoint = new AWS.Endpoint(DataEndpoint)

the code above create an obj endpoint with some properties to be used in the getHLSStreamingSessionURL:

/*First you have to get de data endpoint calling getDataEndpoint*/  
export const getEndPoint = (streamNme) => { 
return new Promise((resolve, reject) => {    
kinesisVideo.getDataEndpoint({
                StreamName: streamName,
                APIName: "GET_HLS_STREAMING_SESSION_URL"
            }, function (err, response) {

            if ( err ) { 
                  return console.error(err); 
            }
            // console.log('Data endpoint: ' + response.DataEndpoint);
            resolve(response.DataEndpoint)
            });
        })
    
    export const getStream = (StreamName, DataEndpoint) => {
      return new Promise((resolve, reject) => {
        kinesisVideoArchivedContent.endpoint = new AWS.Endpoint(DataEndpoint)
        const PlaybackMode = 'LIVE'
        const FragmentSelectorType = 'SERVER_TIMESTAMP'
        const SESSION_EXPIRATION_SECONDS = 60 * 60
        const params = {
          StreamName,
          PlaybackMode,
          HLSFragmentSelector: {
            FragmentSelectorType,
          },
          Expires: parseInt(SESSION_EXPIRATION_SECONDS),
        }
        kinesisVideoArchivedContent.getHLSStreamingSessionURL(params, (err, response) => {
          if (err) {
            reject(StreamName)
            return
          }
          resolve(response.HLSStreamingSessionURL)
        })
      })
    }

For version 3 The oficial documentation: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-kinesis-video-archived-media/classes/gethlsstreamingsessionurlcommand.html

import { KinesisVideoArchivedMediaClient, GetHLSStreamingSessionURLCommand } from "@aws-sdk/client-kinesis-video-archived-media"; // ES Modules import
/*before the code below you have to call getDataEndpointCommand */
const client = new KinesisVideoArchivedMediaClient(config);
const command = new GetHLSStreamingSessionURLCommand(input);
const response = await client.send(command);

This code of version 3 seems to work fine and returns a 200 with an obj with two properties @mediadata and HLSStreamingSessionURL with undefined, always returns undefined becouse i Think this line is missing for v3:

kinesisVideoArchivedContent.endpoint = new AWS.Endpoint(DataEndpoint)

Thank you in advance

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!