/node-bitcodin

community node.js callback-based module for bitcodin.com

Primary LanguageJavaScriptMIT LicenseMIT

node-bitcodin

NPM

community node.js callback-based module for bitcodin.com

Simple callback-based module for bitcodin.com REST-API (only supports Amazon S3 if you need other types of storage, please contact me. )

Super simple to use

install:

$ npm i node-bitcodin --save

init:

var bitcodin = require('node-bitcodin')('THIS_IS_MY_API_KEY');

or

var bitcodin = require('node-bitcodin');
/*
other code
*/
var bitcodinClient = new bitcodin('THIS_IS_MY_API_KEY');

add s3 credentials:

   bitcodinClient.setS3({
        "accessKey": "THIS_IS_MY_S3_ACCESS_KEY",
        "secretKey": "THIS_IS_MY_S3_SECRET_KEY"
    });

More info see: bitcodin cloud transcoding system

createInput

   bitcodinClient.createInput(
                {
                    "type": "s3",
                    "bucket": "THIS_IS_MY_S3_BUCKET",
                    "region": "THIS_IS_MY_S3_REGION",
                    "objectKey": "THIS_IS_MY_OBJECT"
                }, function (err, result) {
                    if (err) {
                     ...
                    }
                   ...

                });

createOutput

   bitcodinClient.createOutput(
                {
                    "type": "s3",
                    "bucket": "THIS_IS_MY_S3_BUCKET",
                    "region": "THIS_IS_MY_S3_REGION",
                    "prefix": "THIS_IS_MY_FOLDER",
                    "makePublic": false
                }, function (err, result) {
                    if (err) {
                     ...
                    }
                   ...

                });

createJob

   bitcodinClient.createJob(
                {
                "inputId": "THIS_IS_MY_INPUT_ID",
                "outputId": "THIS_IS_MY_OUTPOT_ID",
                "encodingProfileId": THIS_IS_MY_ENCDING_PROFILE_ID,
                "manifestTypes": ["mpd", "m3u8"],
                "speed": "standard",
                "duration": 10 // in seconds
                }, function (err, result) {
                    if (err) {
                     ...
                    }
                   ...

                });

jobStatus

   bitcodinClient.jobStatus(THIS_IS_MY_JOB_ID, function (err, result) {
                    if (err) {
                     ...
                    }
                   ...

                });

Todos

  • Write Tests
  • Add raw
  • Add other inputs and outputs

License

MIT