API Docs for:
Show:

streaming Class

Module: streaming

Provides the streaming functionalities.

Methods

config

(
  • path
)

It reads the configuration file and creates new Streaming objects. The file must use the JSON syntax.

The method can throw an Exception.

Parameters:

  • path String

    The path of the configuration file

emit

(
  • ev
  • data
)

Emit an event. It's the same of nodejs events.EventEmitter.emit method.

Parameters:

  • ev String

    The name of the event

  • data Object

    The object to be emitted

getAllStreamingSources

(
  • extenId
  • cb
)
Object

Returns all streaming sources for the user of empty object in error case.

Parameters:

  • extenId String

    The extension endpoint identifier

  • cb Function

    The callback function

Returns:

Object:

The streaming source in JSON format.

getSourceJSONByExten

(
  • extenId
)
Object

Returns the streaming source in JSON format or an empty object on error.

Parameters:

  • extenId String

    The extension endpoint identifier

Returns:

Object:

The streaming source in JSON format.

getVideoSample

(
  • id
  • cb
)

Return the streaming image.

Parameters:

  • id String

    The streaming source identifier

  • cb Function

    The callback function

isExtenStreamingSource

(
  • extenId
)
Boolean

Check if the endpoint extension is a streaming source.

Parameters:

  • extenId String

    The extension endpoint identifier

Returns:

Boolean:

True if the extension endpoint is a steraming source.

on

(
  • type
  • cb
)
Object

Subscribe a callback function to a custom event fired by this object. It's the same of nodejs events.EventEmitter.on method.

Parameters:

  • type String

    The name of the event

  • cb Function

    The callback to execute in response to the event

Returns:

Object:

A subscription handle capable of detaching that subscription.

open

(
  • streamId
  • callerid
  • cb
)

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

Parameters:

  • streamId String

    The streaming source identifier

  • callerid String

    The caller identifier

  • cb Function

    The callback function

reload

() private

Reload the component.

reset

() private

Reload the component.

setCompAstProxy

(
  • ap
)

Sets the asterisk proxy component used for asterisk functions.

Parameters:

  • ap Object

    The asterisk proxy component.

setCompAuthorization

(
  • ca
)

Set the authorization architect component used by customer card functions.

Parameters:

  • ca Object

    The authorization 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.

start

()

Start to sample video streaming sources each framerate.

subscribeSource

(
  • username
  • streamId
  • cb
)

Subscribe to a streaming source.

Parameters:

  • username String

    The username to subscribe with

  • streamId String

    The streaming source identifier

  • cb Function

    The callback function

unsubscribeSource

(
  • username
  • streamId
  • cb
)

Unsubscribe from a streaming source.

Parameters:

  • username String

    The username to subscribe with

  • streamId String

    The streaming source identifier

  • cb Function

    The callback function

Properties

compAstProxy

Object private

The asterisk proxy component used for asterisk functions.

compAuthorization

Object private

The authorization architect component used for customer card functions.

CONFIG_FILEPATH

String private

The configuration file path.

emitter

Object private

The event emitter.

EVT_RELOADED

String

The name of the reloaded event.

Default: "reloaded"

EVT_STREAMING_SOURCE_CHANGED

String

The name of the streaming source update event.

Default: "streamingSourceUpdate"

EVT_STREAMING_SOURCE_SUBSCRIBED

String

The name of the streaming source subscribe event.

Default: "streamingSourceSubscribed"

EVT_STREAMING_SOURCE_UNSUBSCRIBED

String

The name of the streaming source unsubscribe event.

Default: "streamingSourceUnsubscribed"

IDLOG

String private final

The module identifier used by the logger.

Default: [streaming]

intervalGetSourceSample

Number private

The identifier of the interval used to get the source samples.

logger

Object private

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

Default: console

streamings

Object private

The streaming objects. The keys are the streaming identifiers and the values are the Streaming objects. It is initialiazed by the config function.

Default: {}

Events

reloaded

Fired when the componente has been reloaded.

streamingSourceChanged

Fired when the streaming source has been sampled.

streamingSourceSubscribed

Fired when the streaming source has been subscribed.

streamingSourceUnsubscribed

Fired when the streaming source has been unsubscribed.