cine.io node pakage
The node package for cine.io.
Installation
npm install --save cine-io
Usage
Initialization
CineIO = ;client = CineIO;client = CineIO; //needed for fetching all projects
Functions
Projects
To get data about your projects:
clientprojectsindex{};// projects is an array of simple javascript objects: [{id: 'project id', name: 'project name', …}, …]
Project
To get data about your project:
clientproject;// project is a simple javascript object: {id: 'project id', name: 'project name', …}
To update your project attributes:
// params// name: 'a new project name'clientproject;// project is a simple javascript object: {id: 'project id', name: 'a new project name', …}
To delete your project and all associated streams:
clientproject;// project is a simple javascript object that will include deletedAt: {id: 'project id', name: 'project name', deletedAt: 'ISO date' …}
Streams
To get all your streams:
clientstreamsindex{};clientstreamsindexname: 'my custom name' {};// streams is an array of javascript objects: [{id: 'stream id', play: {rtmp: 'the rtmp url', hls: 'the hls url'}, publish: {stream: 'the stream name', url: 'the publish url'}, …}, …]
To get a specific stream:
clientstreams;// stream is a simple javascript object: {id: 'stream id', …}
To create a new stream:
clientstreams;// stream is a simple javascript object: {id: 'stream id', …}
// can optionally take params// params:// name: 'an optional stream name'// record: true|false (default false). record: true will save recordings of all streaming sessionsclientstreams;// stream is a simple javascript object: {id: 'stream id', name: 'an optional stream name', …}
To update a stream:
// params:// name: 'a new stream name'// record: true|false (updating a stream from true to false will not delete old stream recordings)clientstreams;// stream is a simple javascript object: {id: 'stream id', name: 'a new stream name', …}
To delete a specific new stream:
clientstreams;// stream is a simple javascript object that will include deletedAt: {id: 'stream id', deletedAt: 'ISO Date', …}
To fetch the Flash Media Live Encoder profile for a stream:
clientstreams;// profile is a string of the contents of the Flash Media Live Encoder profile.
Stream Recordings
To get all your stream recordings:
clientstreams;// streamRecordings is an array of javascript objects: [{name: 'stream id', url: 'the playable url', size: size in bytes as integer, date: 'ISO Date of recording'}, …}, …]
To delete a specific new stream:
clientstreamsrecordings;// streamRecording is a simple javascript object that will include deletedAt: {deletedAt: 'ISO Date'}
Peer
Identity Signature Generation
var identity = "Unique user name to your app";response = clientpeer;// response looks like {signature: "sha1-hash", timestamp: 1420258111, identity: "Unique user name to your app"}
Usage
Use these api endpoints to fetch the monthly usage for a project or a stream.
Project Usage
var options = month: report: 'bandwidth, 'peer']};response = client.usage.project(options, function(err, response){});// response looks like {bandwidth: 12345, storage: 54321, month: "month (ISO 8601 format)", secretKey: "YOUR SECRET KEY"}// bandwidth and storage are represented in bytes
Stream Usage
var id = 'STREAM_ID';var options = month: report: 'bandwidth, 'peer']};response = client.usage.stream(id, options, function(err, response){});// response looks like {bandwidth: 12345, storage: 54321, month: "month (ISO 8601 format)", secretKey: "YOUR SECRET KEY", id: "STREAM_ID"}// bandwidth and storage are represented in bytes
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request