IConnector is a common interface for representing a stream connection with the server.

This interface can serve the both roles: player or streamer.

Hierarchy

Implemented by

Properties

closed: boolean

True when connector is closed, in other words when onClose event is fired

codecs: Set<string>

Indicate codecs supported, should be set before than onOpen happen

log: ILog

Start a log

Param

Returns

a Log object with the levels of log to call

opened: boolean

True when connector is opened, in other words when onOpen event is fired

stream?: MediaStream

Media Stream description delivred from the server if we are player, or build from the local camera if we are the streamer.

streamName: string

Stream name, for example as+bc3f535f-37f3-458b-8171-b4c5e77a6137

Methods

  • Request connections infos with caching option to save loading cost

    Parameters

    • Optional cacheDuration: number

      indicate how many time we can cache the last connection informations

    Returns Promise<ConnectionInfos>

    Promise with a ConnectionInfos on success

  • Event unsubscription

    Parameters

    • name: "open" | "close" | "Close" | "Open"

      Name of event without the 'on' prefix (ex: 'log' to 'onLog' event declared)

    • event: Function

      Unsubscriber Function, must be the one passed to on or once subscription methods

    Returns boolean

  • Event subscription

    Parameters

    • name: "open" | "close" | "Close" | "Open"

      Name of event without the on prefix (ex: log to onLog event declared)

    • event: Function

      Subscriber Function

    • Optional options: {
          signal?: AbortSignal;
      }
      • Optional signal?: AbortSignal

        Optional AbortSignal to stop this or multiple subscriptions in same time

    Returns void

  • Event subscription only one time, once time fired it's automatically unsubscribe

    Parameters

    • name: "open" | "close" | "Close" | "Open"

      Name of event without the on prefix (ex: log to onLog event declared)

    • event: Function

      Subscriber Function

    • Optional options: {
          signal?: AbortSignal;
      }
      • Optional signal?: AbortSignal

    Returns void

Events

  • Call when connector is open

    Parameters

    • stream: MediaStream

      MediaStream description provided from the server if we are the player, or build from the local camera if we are the streamer.

    Returns void

Generated using TypeDoc