WebRTC Video Chat 1.1.2
Loading...
Searching...
No Matches
Byn.Awrtc.ICall Interface Reference

Main interface for platform independent video calls. More...

Inheritance diagram for Byn.Awrtc.ICall:
Byn.Awrtc.AWebRtcCall

Public Member Functions

void Configure (MediaConfig config)
 Sets the media configuration. Usually, this can only be called once before the actual call starts via .Call/Listen.
 
void Listen (string address)
 Listens on a given address (any string shorter than 256 characters).
 
void StopListening ()
 Used by multiuser calls to block new users from joining.
 
void Call (string address)
 Will try to connect to an address of another Call object (which called Listen). Don't use in conference mode!
 
void Send (string message)
 Sends a text message to the connected users.
 
void Send (string message, bool reliable)
 Same as Send(string message) but allows to send unreliable as well.
 
bool Send (string message, bool reliable, ConnectionId id)
 Sends a string message to a specific connection and checks the status of the buffer. Prefer this call over the simplified methods!
 
void Send (byte[] data, bool reliable)
 This will send data to all conencted users.
 
bool Send (byte[] data, bool reliable, ConnectionId id)
 Sends the content of a byte array to the given connection and checks the status of the buffer. Prefer this call over the simplified methods!
 
void Update ()
 Call this to update the internal state of this object and trigger the events. You should do this around 30-60 times per second.
 
void SetVolume (double volume, ConnectionId remoteUserId)
 Sets a volume for the replay of a remote connections audio stream.
 
bool HasAudioTrack (ConnectionId remoteUserId)
 Checks if the connection with the given id has a media stream with an audio track attached.
 
bool HasVideoTrack (ConnectionId remoteUserId)
 Checks if the connection with the given id has a media stream with an video track attached.
 
bool IsMute ()
 Checks if the local audio track (local microphone) is muted. True means it is muted. False means it isn't muted (via this system). This doesn't mean the microphone is actually sending. It still can be muted within the OS or via the physicial device.
 
void SetMute (bool val)
 Allows to mute the local audio track (local microphone)
 
int GetBufferedAmount (ConnectionId id, bool reliable)
 Allows to check the size of the internal message buffer. If this is above 0 the Send methods try to push more data to the network than the network layer can deliver.
 
void Disconnect (ConnectionId id)
 Disconnects a specific connection.
 

Properties

bool LocalFrameEvents [get, set]
 If this property is set to true the call object will return an Event of type FrameUpdateEventArgs each time the local video device created a new frame. Set this to false if you don't want to show the local user image or there is an alternative way to showing the frame.
 

Events

CallEventHandler CallEvent
 Event handler. Returns all events from new accepted calls to frame updates of the local and remote camera.
 

Detailed Description

Main interface for platform independent video calls.

Usage of this interface usually follows a specific pattern:

  1. Create a platform specific instance via a factory with a specific NetworkConfig
  2. Register an event handler at CallEvent
  3. Call configure with your own MediaConfig instance defining what features you need.
  4. Wait for a ConfigurationComplete (or failed) event. During this time the platform might ask the user the allow access to the devices.
  5. Either call Listen with an address to wait for an incoming connection or use Call to connect another ICall that already listens on that address.
  6. Wait for CallAccepted and other events

Do not forget to call Dispose method after you finished the call or the connection might run forever in the background!

Member Function Documentation

◆ Call()

void Byn.Awrtc.ICall.Call ( string address)

Will try to connect to an address of another Call object (which called Listen). Don't use in conference mode!

Parameters
addressAny string. Max 256 characters.

Implemented in Byn.Awrtc.AWebRtcCall.

◆ Configure()

void Byn.Awrtc.ICall.Configure ( MediaConfig config)

Sets the media configuration. Usually, this can only be called once before the actual call starts via .Call/Listen.

If you want to call Configure at runtime to change settings on the fly use set the flag NetworkConfig.KeepSignalingAlive (experimental)

Parameters
configThe new configuration to apply.

Implemented in Byn.Awrtc.AWebRtcCall.

◆ Disconnect()

void Byn.Awrtc.ICall.Disconnect ( ConnectionId id)

Disconnects a specific connection.

Parameters
idID of the connection to cut.

Implemented in Byn.Awrtc.AWebRtcCall.

◆ GetBufferedAmount()

int Byn.Awrtc.ICall.GetBufferedAmount ( ConnectionId id,
bool reliable )

Allows to check the size of the internal message buffer. If this is above 0 the Send methods try to push more data to the network than the network layer can deliver.

Parameters
id
reliable
Returns
Returns size of internal message buffer in bytes.

Implemented in Byn.Awrtc.AWebRtcCall.

◆ HasAudioTrack()

bool Byn.Awrtc.ICall.HasAudioTrack ( ConnectionId remoteUserId)

Checks if the connection with the given id has a media stream with an audio track attached.

Returns
True if at least one audio track is attached. False if no audio track or no media stream

Implemented in Byn.Awrtc.AWebRtcCall.

◆ HasVideoTrack()

bool Byn.Awrtc.ICall.HasVideoTrack ( ConnectionId remoteUserId)

Checks if the connection with the given id has a media stream with an video track attached.

Returns
True if at least one video track is attached. False if no video track or no media stream

Implemented in Byn.Awrtc.AWebRtcCall.

◆ IsMute()

bool Byn.Awrtc.ICall.IsMute ( )

Checks if the local audio track (local microphone) is muted. True means it is muted. False means it isn't muted (via this system). This doesn't mean the microphone is actually sending. It still can be muted within the OS or via the physicial device.

Returns
true - muted false - not muted

Implemented in Byn.Awrtc.AWebRtcCall.

◆ Listen()

void Byn.Awrtc.ICall.Listen ( string address)

Listens on a given address (any string shorter than 256 characters).

The event handler will return WaitForIncomingCall once incoming calls can be received and ListeningFailed if an error occurred.

In conference mode multiple calls listening on the same address will be connected.

Parameters
addressAny string. Max 256 characters.

Implemented in Byn.Awrtc.AWebRtcCall.

◆ Send() [1/5]

void Byn.Awrtc.ICall.Send ( byte[] data,
bool reliable )

This will send data to all conencted users.

Use only for low traffic applications (e.g. text messages). Messages might be dropped if too much data is sent. Use bool Send(byte[] data, bool reliable, ConnectionId id); for advanced use cases.

Parameters
data
reliabletrue to use the TCP style channel, false for UDP style

Implemented in Byn.Awrtc.AWebRtcCall.

◆ Send() [2/5]

bool Byn.Awrtc.ICall.Send ( byte[] data,
bool reliable,
ConnectionId id )

Sends the content of a byte array to the given connection and checks the status of the buffer. Prefer this call over the simplified methods!

Make sure to check the result of this method. False indicates the data wasn't sent.

Calls to SendData will store the data in an internal buffer. Once the network is ready the data will be sent.

Pitfalls and additional information:

  • Sending data faster than the network can deliver will increase the buffered amount and thus increase the latency between the two peers.
  • the buffer is several MB but once full this method will return false and stop accepting data until the network could deliver more data
  • Keep package size under 16,000,000 bytes
  • For low latency keep the size and buffered data as low as possible
  • For high throughput keep the buffer size high (this class is not optimized for throughput though)
  • Use IWebRtcNetwork.GetBufferedAmount to check the buffer size
  • Add your own congestion control to better keep track on the data flow to ensure other devices can keep up with the amount of data sent.
Parameters
dataByte array containing the data to send. Keep below 16,000,000 bytes
reliableTrue to send a reliable message(TCP style) and false to send unreliable (UDP style). Reliable messages are ordered and will be resent if lost during transmission. They can still be dropped if the internal buffer overflows (will return false). Unreliable messages are sent without a specific order and won't be resent if delivery fails even if this method returned true!
idThe id of the recipient
Returns
Returns false if:
  • The id is invalid (should never happen unless you have a bug in your code)
  • the the connection is disconnected (you will also get an event via Dequeue to handle it)
  • The internal buffer is full to buffer

Implemented in Byn.Awrtc.AWebRtcCall.

◆ Send() [3/5]

void Byn.Awrtc.ICall.Send ( string message)

Sends a text message to the connected users.

Use only for low traffic applications (e.g. text messages). Messages might be dropped if too much data is sent. See bool Send(string message, bool reliable, ConnectionId id); for advanced use cases.

Parameters
message

Implemented in Byn.Awrtc.AWebRtcCall.

◆ Send() [4/5]

void Byn.Awrtc.ICall.Send ( string message,
bool reliable )

Same as Send(string message) but allows to send unreliable as well.

Use only for low traffic applications (e.g. text messages). Messages might be dropped if too much data is sent. See bool Send(string message, bool reliable, ConnectionId id); for advanced use cases.

Parameters
message
reliable

Implemented in Byn.Awrtc.AWebRtcCall.

◆ Send() [5/5]

bool Byn.Awrtc.ICall.Send ( string message,
bool reliable,
ConnectionId id )

Sends a string message to a specific connection and checks the status of the buffer. Prefer this call over the simplified methods!

For details see also the documentation of bool Send(string message, bool reliable, ConnectionId id);

Parameters
messageAny string message. Keep below 8000 characters.
reliabletrue for TCP style connections, false for UDP style (messages might not be delivered)
idThe ConnectionId to send the message two.
Returns
Returns false if the message could be sent either because the ConnectionId isn't valid, user disconnected or the internal buffer is full. Try to resend the message after a while.

Implemented in Byn.Awrtc.AWebRtcCall.

◆ SetMute()

void Byn.Awrtc.ICall.SetMute ( bool val)

Allows to mute the local audio track (local microphone)

True = mute False = send the microphone data if available

Parameters
valtrue - set to mute false - not muted

Implemented in Byn.Awrtc.AWebRtcCall.

◆ SetVolume()

void Byn.Awrtc.ICall.SetVolume ( double volume,
ConnectionId remoteUserId )

Sets a volume for the replay of a remote connections audio stream.

Parameters
volume1 = normal volume, 0 = mute, everything above 1 might increase volume but reduce quality
remoteUserIdId of the remote connection.

Implemented in Byn.Awrtc.AWebRtcCall.

◆ StopListening()

void Byn.Awrtc.ICall.StopListening ( )

Used by multiuser calls to block new users from joining.

Implemented in Byn.Awrtc.AWebRtcCall.

◆ Update()

void Byn.Awrtc.ICall.Update ( )

Call this to update the internal state of this object and trigger the events. You should do this around 30-60 times per second.

Implemented in Byn.Awrtc.AWebRtcCall.

Property Documentation

◆ LocalFrameEvents

bool Byn.Awrtc.ICall.LocalFrameEvents
getset

If this property is set to true the call object will return an Event of type FrameUpdateEventArgs each time the local video device created a new frame. Set this to false if you don't want to show the local user image or there is an alternative way to showing the frame.

Setting this value to false will increase performance and reduce needed memory as it avoids unnecessary image copies / processing.

Implemented in Byn.Awrtc.AWebRtcCall.

Event Documentation

◆ CallEvent

CallEventHandler Byn.Awrtc.ICall.CallEvent

Event handler. Returns all events from new accepted calls to frame updates of the local and remote camera.

All events will be triggered during call of the Update method (see below) to avoid multi threading issues.


The documentation for this interface was generated from the following file: