🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

hapi-ams-sdk

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-ams-sdk

Hapi plugin for Microsoft Azure Media Services REST API

0.0.2
latest
Source
npm
Version published
Weekly downloads
5
150%
Maintainers
1
Weekly downloads
 
Created
Source

hapi-ams-sdk

Hapi plugin for Microsoft Azure Media Services REST API, based on node-ams-sdk project, but wrapped in an Hapi plugin with Channels support

Usage


npm i --save hapi-ams-sdk

You initialize the service by providing a configuration object

var HapiAmsSdk  = require('hapi-ams-sdk')

var configObj = {
  client_id: "",
  client_secret: ""
}

var serviceConfig = require('../path/to/config') || configObj

...

// Register Azure Media Services REST API wrapper plugin

server.register({
  register: HapiAmsSdk,
  options: serviceConfig
}, (err) => {
  if (err) {
    console.log(err)
    throw err
  }

  // You can always access the amsService in your Hapi project
  var amsService = server.plugins['hapi-ams-sdk'].amsService
  var data = ''
  amsService.listChannels()
   .on('data', (d) => {
     data += d
     console.log(d)
   })
   .on('error', (e) => {
     console.log(e)
   })
   .on('end', () => {
     console.log(data)
     // var jsonData = JSON.parse(data)
   })
})

Azure Media Services Resources Provided

Channels

####listChannels([cb])

Takes an optional callback. Will list all channels - streaming if no cb.

####getChannel(channelId, [cb])

Requires a channelId like ''nb:chid:UUID:2c30f424-ab90-40c6-ba41-52a993e9d393''. Will return all information for a channel. Will stream if optional callback is not provided.

####resetChannel(channelId, cb)

Requires a channelId like ''nb:chid:UUID:2c30f424-ab90-40c6-ba41-52a993e9d393''. Will return an object with a 'operationId' property (String). You can use this operationId string to poll AMS with a 'getOperationState' call.

Operations

####getOperationState(operationId, [cb])

Requires a operationId like ''nb:opid:UUID:9e17ee32-99eb-45f0-8b0f-08f4e8304833''. Will return all information for a long operation like Start/Stop/Reset Channel. Will stream if optional callback is not provided.

Keywords

Azure

FAQs

Package last updated on 25 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts