API Docs for:
Show:

rtc.LocalPeer Class

Extends rtc.Peer
Module: rtc

Represents the local user of the room

Constructor

rtc.LocalPeer

()

Methods

addDataChannel

(
  • [name='data']
  • [desc={ordered: true}]
)

Add data channel which will be negotiated with all remote peers

Parameters:

  • [name='data'] String optional

    Name of the data channel

  • [desc={ordered: true}] Object optional

    Options passed to RTCDataChannel.createDataChannel()

addStream

(
  • [name='stream']
  • stream
)
Promise -> rtc.Stream

Add local stream to be sent to all remote peers

Parameters:

  • [name='stream'] String optional

    Name of the stream

  • stream Promise -> rtc.Stream | rtc.Stream | Object

    The stream, a promise to the stream or the configuration to create a stream with rtc.Stream.createStream()

Returns:

Promise -> rtc.Stream:

Promise of the stream which was added

isLocal

() Boolean

Checks whether the peer is the local peer. Returns always true on this class.

Returns:

Boolean:

Returns true

status

(
  • key
)

Inherited from rtc.Peer but overwritten in src/local_peer.coffee:34

Get an item of the status transferred to all remote peers

Parameters:

  • key String

    The key of the value. Will return

Returns:

The value associated with the key

status

(
  • key
  • value
)

Set an item of the status transferred to all remote peers

Parameters:

  • key String

    The key of the value. Will return

  • value Object

    The value to store

stream

(
  • [name='stream']
)
Promise -> rtc.Stream

Get local stream

Parameters:

  • [name='stream'] String optional

    Name of the stream

Returns:

Promise -> rtc.Stream:

Promise of the stream

Properties

channels

Object

Contains all DataChannel configurations negotiated with all remote peers

streams

Object

Contains promises of the local streams offered to all remote peers

Events

status_changed

(
  • status
)

Inherited from rtc.Peer: src/peer.coffee:12

The status of the peer has changed

Parameters:

  • status Object
    The new status object