API Docs for:
Show:

plugin_rest_streaming Class

Module: plugins_rest
Parent Module: com_streaming_rest

REST plugin that provides streaming functions through the following REST API:

GET requests

  1. streaming/sources
  2. streaming/image/:source

streaming/sources

Returns all the streaming sources.

Example JSON response:

{
    "door": {
         "id": "door",
         "url": "http://192.168.5.169/enu/camera352x272.jpg",
         "type": "helios",
         "user": "",
         "cmdOpen": "0*",
         "password": "",
         "frameRate": "1000",
         "extension": "609",
         "description": "door"
    }
}

streaming/image/:source

Returns the image of the streaming source base64 encoded. The source parameter is the source identifier that can be obtained with streaming/sources rest api.

Example JSON response:

{
    "image": "id": "data:image/jpeg;base64,AA879..."
}

POST requests

  1. streaming/open
  2. streaming/subscribe
  3. streaming/unsubscribe

streaming/open

Execute the command associated with the streaming to open the associated device, e.g. a door. The request must contains the following parameters:

  • id: the streaming identifier

Example JSON request parameters:

{ "id": "door" }

streaming/subscribe

Subscribe to a streaming source. After subscribing the source the user will receive streaming events for the subscribed streaming source. The request must contains the following parameters:

  • id: the streaming source identifier

Example JSON request parameters:

{ "id": "vs_gate1" }

streaming/unsubscribe

Unsubscribe from a streaming source. After unsubscribing the source the user will not receive streaming events for the unsubscribed streaming source. The request must contains the following parameters:

  • id: the streaming source identifier

Example JSON request parameters:

{ "id": "vs_gate1" }

Methods

open

(
  • req
  • res
  • next
)

Executes the command associated with the streaming source to open the associated device, e.g. a door, with the following REST API:

open

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

setCompAuthorization

(
  • ca
)

Set authorization architect component.

Parameters:

  • ca Object

    The authorization architect component.

setCompConfigManager

(
  • comp
)

Sets config manager architect component.

Parameters:

  • comp Object

    The config manager architect component.

setCompStreaming

(
  • cp
)

Set streaming architect component used by streaming functions.

Parameters:

  • cp Object

    The streaming architect component.

setCompUtil

(
  • comp
)

Sets the utility architect component.

Parameters:

  • comp Object

    The utility architect component.

setLogger

(
  • log
)
static

Set the logger to be used.

Parameters:

  • log Object

    The logger object. It must have at least three methods: info, warn and error as console object.

sources

(
  • req
  • res
  • next
)

Returns all the streaming sources by the following REST API:

sources

Parameters:

  • req Object

    The client request.

  • res Object

    The client response.

  • next Function

    Function to run the next handler in the chain.

sources

(
  • req
  • res
  • next
)

Return the image of the streaming source by the following REST API:

image/:source

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

subscribe

(
  • req
  • res
  • next
)

Subscribe to a streaming source with the following REST API:

subscribe

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

unsubscribe

(
  • req
  • res
  • next
)

Unsubscribe from a streaming source with the following REST API:

unsubscribe

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

Properties

compAuthorization

Object private

The architect component to be used for authorization.

compConfigManager

Object private

The config manager architect component.

compStreaming

Object private

The streaming architect component used for streaming functions.

compUtil

Object private

The utility architect component.

get

Array

REST API to be requested using HTTP GET request.

Sub-properties:

  • sources String

    To gets all the streaming sources

  • image/:source String

    To get the image of the streaming source

IDLOG

String private final

The module identifier used by the logger.

Default: [plugins_rest/streaming]

logger

Object private

The logger. It must have at least three methods: info, warn and error.

Default: console

post

Array

REST API to be requested using HTTP POST request.

Sub-properties:

  • open String

    To execute the command associated with the streaming source