Giter Site home page Giter Site logo

jstb's Introduction

Node Javascript API for Stbs

Introduction

The JStb API for STBs provides a HTTP/JSON API for management of functionality on the Settop box. Often embedded functions are written C/CPP, which is great. However with modern application environments those C/CPP functions can be harder to reach. Especially from a web browser, android app or other device within the network.

The interface principles: JSONRPC 2.0

HTTP GET/PUT/POST where the JSON is in the URL or Body
Async messages through Server Sent Events (SSE's)

Or: WebSockets for Control & Response

Interface specification

Player

method: Player; actions: ['CreatePlayer'|'UpdatePlayer'|'DestroyPlayer'];

Create player

Request '''method: player.createPlayer Params { source: { type : 'ip' protocol: 'hls'|'http' url : 'http://a/b.m3u8' }, transcoding : {}, //not yet supported destination: { type : 'display'|'record' format : 'hls' contentProtection : '' //not supported }, player : { rate: 1, //float } }'''

Response note this may be repeated as the player state changes over time as a notification without jsonrpc:id

'''Result: { Player : { id : 0, //player Id status : '200', //1xx for init, 2xx for OK, 3xx for temp errors, 4xx for well defined errors, 5xx for unkown errors position : 10, //in NPT rate : 1, //play rate streams: [ //array of variant streams that are from the m3u8 { streamIdx : 0, //index for reselection bitrate: 2500, // kb/s resolution: '416x234', //resolution from m3u8 codecs: 'avc1.42e00a,mp4a.40.2' //codecs from m3u8 } ] } }'''

Update player

Request '''method: player.updatePlayer Params: { Player : { id : 0, //id of the player position : 11, //optional, to jump in the stream rate : 1 //optional -2,-4 for rewind and 2,4,8 for fast foward. 0 for pause variantStreamIdx: 0 //optional indicates the variant stream selection for multiple streams in the m3u8 if app wants to override } }'''

Response See create player response

Delete Player

Request method: player.destroyPlayer Player : { id : 0 }

Response Result : 200;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.