1.1.16 • Published 4 years ago

@mgara/live_scale_api v1.1.16

Weekly downloads
-
License
Unlicense
Repository
-
Last release
4 years ago

live_scale_api

LiveScaleApi - JavaScript client for livescale_api Welcome to the _LiveScale API Documentation. The LiveScale API allows you to connect your application to our live distribution platform and stream your events with just a few lines of code. # OpenAPI Specification This API is documented in OpenAPI format # Cross-Origin Resource Sharing This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with W3C spec. That allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site. # Authentication LiveScale API offers OAuth2 as a form of authentication: OAuth2 - an open protocol to allow secure authorization in a simple and standard method from web, mobile and desktop applications. # API Definitions This API relies on the following definitions. - Event : An Event represents a parameterized instance where a presenter can manage and monitor his live presentation. - Presets : The transcoding output profile, for better result, always make sure your preset's width and height are equal or lower than the resolution of your input feed while preserving the aspect ratio. - Destinations : A social network destination or a custom rtmp destination. Social Media destinations can only be added to a User's account using the LiveScale web interface since it requires an external authentification. - Regions : The geographic location of the live transcoding infrastructure. You should Specify the region closest to the source for lower latency. - Ingest : The ingest resource created either automatic when the event is created, or created before hand and parametirized at the event creation. The url of the Ingest is where the live video feed is sent. - Player : The Livescale embeddable player resource. Created automatically for every events or created before hand and parametirized at the event creation. - Dynamic Update : The possibility to stop, start and add specific destinations to an ongoing Live event. # API Basic Flow The basic flow of the API goes as follow: 1. Authenticate your client to the API with the POST /token operation. 2. Get the video transcoding presets with the GET /presets method. 3. Get the available cloud infrastructures regions with the GET /regions method. 4. Create a parameterized event with the POST /events method. 5. Start the video engine with the POST /events/{event_id}/start method. 6. Once the video engine is started, you can Start your Live Feed 7. Go Live with the POST /events/{event_id}/live method. 8. Finally, Close the event with the DELETE /events/{event_id} method. # API Optional Options - Get available user destinations (e.g. : social networks) with the GET /destinations method. - Create static ingest points with the POST /ingests method. - Create static dedicated players with the POST /players method. - Dynamically update destinations during the live representation with the POST /events/{event_id}/destinations methods. - Monitor the event with the GET /events/{event_id} method. - Event reports which includes statistics are available with GET /events/{event_id} or /events/done method. *Note all calls are made under https://HOSTNAME/api/v1/
This SDK is automatically generated by the Swagger Codegen project:

  • API version: 1.1.13-oas3
  • Package version: 1.1.13-oas3
  • Build package: io.swagger.codegen.v3.generators.javascript.JavaScriptClientCodegen

Installation

For Node.js

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install live_scale_api --save

git

If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var LiveScaleApi = require('live_scale_api');

var api = new LiveScaleApi.AuthenticationApi()
var grantType = "grantType_example"; // {String} 
var scope = "scope_example"; // {String} 
var username = "username_example"; // {String} 
var password = "password_example"; // {String} 

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getToken(grantType, scope, username, password, callback);

Documentation for API Endpoints

All URIs are relative to https://api.livescale.tv/api/v1

ClassMethodHTTP requestDescription
LiveScaleApi.AuthenticationApigetTokenPOST /tokenGet authentication token
LiveScaleApi.DestinationApicreateGenericDestinationPOST /destinationsCreate a new Generic destination
LiveScaleApi.DestinationApideleteADestinationDELETE /destinations/{destination_id}Deletes a destination
LiveScaleApi.DestinationApigetUserDestinationsGET /destinationsGet user's destinations
LiveScaleApi.DestinationApisearchDestinationsPOST /destinations/searchSearch destinations
LiveScaleApi.EventApiappendDestinationPOST /events/{event_id}/destinationsAppend a destination to the event
LiveScaleApi.EventApicreateEventPOST /eventsCreate a new event
LiveScaleApi.EventApideleteDestinationFromEventDELETE /events/{event_id}/destinationsRemove a destination from an event
LiveScaleApi.EventApiendEventDELETE /events/{event_id}End/Cancel/Close an event
LiveScaleApi.EventApiendLiveForDestinationPOST /events/{event_id}/destinations/stopStop the live presentation on a single destination.
LiveScaleApi.EventApigetClosedEventsGET /events/doneGet the list of the user's closed events
LiveScaleApi.EventApigetEventByIdGET /events/{event_id}Get event information by its Id
LiveScaleApi.EventApigetOpenEventsGET /eventsGet the list of the user's open events
LiveScaleApi.EventApigoLivePOST /events/{event_id}/liveGo Live
LiveScaleApi.EventApigoLiveForDestinationPOST /events/{event_id}/destinations/startGo live on a single destination
LiveScaleApi.EventApisearchEventPOST /events/searchSearch Events
LiveScaleApi.EventApistartVideoEnginePOST /events/{event_id}/startStarts an event's video engine instance
LiveScaleApi.EventApistopVideoEnginePOST /events/{event_id}/stopStops an event's video engine instance
LiveScaleApi.EventApiupdateEventPUT /events/{event_id}Update the event
LiveScaleApi.IngestApicreateIngestPOST /ingestsCreate a new ingest point
LiveScaleApi.IngestApideleteIngestByIdDELETE /ingests/{ingest_id}Delete ingest point
LiveScaleApi.IngestApigetAllIngestsGET /ingestsGet the list of the user's ingest points
LiveScaleApi.IngestApigetIngestByIdGET /ingests/{ingest_id}Get ingest information by its Id
LiveScaleApi.IngestApisearchIngestPOST /ingests/searchSearch Ingests
LiveScaleApi.PlayerApicreatePlayerPOST /playersCreate web player
LiveScaleApi.PlayerApideletePlayerByIdDELETE /players/{player_id}Delete web player
LiveScaleApi.PlayerApigetAllPlayersGET /playersGet the list of the user's players
LiveScaleApi.PlayerApigetPlayerByIdGET /players/{player_id}Get player information by its Id
LiveScaleApi.PlayerApisearchPlayerPOST /players/searchSearch Players
LiveScaleApi.PresetApipresetsGetGET /presetsList all available transcoding presets
LiveScaleApi.RegionApiregionsGetGET /regionsList all integrated cloud providers by regions
LiveScaleApi.UserApistylePOST /user/styleCreate user's style
LiveScaleApi.UserApiuserStyleGetGET /user/styleGet user's default style

Documentation for Models

Documentation for Authorization

application

  • Type: OAuth
  • Flow: password
  • Authorization URL:
  • Scopes:
    • :
1.1.16

4 years ago