Socket
Socket
Sign inDemoInstall

hapi-ams-sdk

Package Overview
Dependencies
53
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-ams-sdk

Hapi plugin for Microsoft Azure Media Services REST API


Version published
Maintainers
1
Weekly downloads
1

Weekly downloads

Readme

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

FAQs

Last updated on 25 Jan 2016

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc