Webrtc Unity Plugin  v01
Cross-platform Webrtc support for Unity apps ☁🎲
UnityWebrtc.WebrtcPeerEvents Class Reference

Peer event frontend More...

Inheritance diagram for UnityWebrtc.WebrtcPeerEvents:
UnityWebrtc.IPeerImpl

Classes

class  WebrtcPeerString2Event
 Represents a peer event composed of two string-literals More...
 
class  WebrtcPeerStringEvent
 Represents a peer event composed of a single string-literal More...
 
class  WebrtcPeerStringIntStringEvent
 Represents a peer event composed of a string-literal, an int, and another string-literal More...
 

Public Member Functions

void OnInitialized ()
 Initialization handler More...
 
void AddDataChannel ()
 we front the IPeer interface for the underlying peer so that UnityEvents and engine code have something they can bind to to trigger the actual calls More...
 
void AddIceCandidate (string candidate, int sdpMlineindex, string sdpMid)
 Add an ice candidate More...
 
void AddStream (bool audioOnly)
 Add a stream More...
 
void ClosePeerConnection ()
 Close the peer connection More...
 
void CreateAnswer ()
 Create an sdp answer More...
 
void CreateOffer ()
 Create an sdp offer More...
 
int GetUniqueId ()
 Get the unique id More...
 
void SendDataViaDataChannel (string data)
 Send data via the created data channel More...
 
void SetAudioControl (bool isMute, bool isRecord)
 Adjust audio controls More...
 
void SetRemoteDescription (string type, string sdp)
 Set the remote stream description More...
 
void Log ()
 We provide a function Log() that matches the params of all exposed events so that one may easily wire UnityEvents to Log calls using this.Log() as a reference in editor More...
 
void Log (string arg1)
 
void Log (string arg1, string arg2)
 
void Log (string arg1, int arg2, string arg3)
 

Public Attributes

bool AutoLogErrors = true
 Flag to log all errors to the Unity console automatically More...
 
UnityEvent OnPeerReady = new UnityEvent()
 Event that occurs when the peer is ready More...
 
WebrtcPeerStringEvent OnDataFromDataChannelReady = new WebrtcPeerStringEvent()
 Event that occurs when data is ready from the data channel More...
 
WebrtcPeerStringEvent OnFailure = new WebrtcPeerStringEvent()
 Event that occurs when a peer-specific failure happens More...
 
WebrtcPeerStringIntStringEvent OnIceCandiateReadyToSend = new WebrtcPeerStringIntStringEvent()
 Event that occurs when an ice candidate is prepared More...
 
UnityEvent OnLocalDataChannelReady = new UnityEvent()
 Event that occurs when the data channel is ready More...
 
WebrtcPeerString2Event OnLocalSdpReadyToSend = new WebrtcPeerString2Event()
 Event that occurs when an sdp message is prepared More...
 
WebrtcPeerStringEvent OnSdpOfferReadyToSend = new WebrtcPeerStringEvent()
 Event that occurs when an sdp offer is prepared More...
 
WebrtcPeerStringEvent OnSdpAnswerReadyToSend = new WebrtcPeerStringEvent()
 Event that occurs when an sdp answer is prepared More...
 

Detailed Description

Peer event frontend

Member Function Documentation

◆ AddDataChannel()

void UnityWebrtc.WebrtcPeerEvents.AddDataChannel ( )

we front the IPeer interface for the underlying peer so that UnityEvents and engine code have something they can bind to to trigger the actual calls

Implements UnityWebrtc.IPeerImpl.

◆ AddIceCandidate()

void UnityWebrtc.WebrtcPeerEvents.AddIceCandidate ( string  candidate,
int  sdpMlineindex,
string  sdpMid 
)

Add an ice candidate

Parameters
candidatesdp candidate data
sdpMlineindexsdp mline index
sdpMidsdp mid

Implements UnityWebrtc.IPeerImpl.

◆ AddStream()

void UnityWebrtc.WebrtcPeerEvents.AddStream ( bool  audioOnly)

Add a stream

Parameters
audioOnlyflag indicating if the stream should only contain audio

Implements UnityWebrtc.IPeerImpl.

◆ ClosePeerConnection()

void UnityWebrtc.WebrtcPeerEvents.ClosePeerConnection ( )

Close the peer connection

Implements UnityWebrtc.IPeerImpl.

◆ CreateAnswer()

void UnityWebrtc.WebrtcPeerEvents.CreateAnswer ( )

Create an sdp answer

Implements UnityWebrtc.IPeerImpl.

◆ CreateOffer()

void UnityWebrtc.WebrtcPeerEvents.CreateOffer ( )

Create an sdp offer

Implements UnityWebrtc.IPeerImpl.

◆ GetUniqueId()

int UnityWebrtc.WebrtcPeerEvents.GetUniqueId ( )

Get the unique id

Returns
unique id

Implements UnityWebrtc.IPeerImpl.

◆ Log()

void UnityWebrtc.WebrtcPeerEvents.Log ( )

We provide a function Log() that matches the params of all exposed events so that one may easily wire UnityEvents to Log calls using this.Log() as a reference in editor

◆ OnInitialized()

void UnityWebrtc.WebrtcPeerEvents.OnInitialized ( )

Initialization handler

TODO(bengreenier): This could be auto-bound with editor script

This is expected to be bound to Webrtc.OnInitialized via the UnityEditor

◆ SendDataViaDataChannel()

void UnityWebrtc.WebrtcPeerEvents.SendDataViaDataChannel ( string  data)

Send data via the created data channel

Must call AddDataChannel first

Parameters
datadata to send

Implements UnityWebrtc.IPeerImpl.

◆ SetAudioControl()

void UnityWebrtc.WebrtcPeerEvents.SetAudioControl ( bool  isMute,
bool  isRecord 
)

Adjust audio controls

Parameters
isMuteis the stream muted
isRecordis the stream recording data

Implements UnityWebrtc.IPeerImpl.

◆ SetRemoteDescription()

void UnityWebrtc.WebrtcPeerEvents.SetRemoteDescription ( string  type,
string  sdp 
)

Set the remote stream description

Known valid types are "answer" and "offer"

Parameters
typedescription type
sdpsdp data

Implements UnityWebrtc.IPeerImpl.

Member Data Documentation

◆ AutoLogErrors

bool UnityWebrtc.WebrtcPeerEvents.AutoLogErrors = true

Flag to log all errors to the Unity console automatically

◆ OnDataFromDataChannelReady

WebrtcPeerStringEvent UnityWebrtc.WebrtcPeerEvents.OnDataFromDataChannelReady = new WebrtcPeerStringEvent()

Event that occurs when data is ready from the data channel

◆ OnFailure

WebrtcPeerStringEvent UnityWebrtc.WebrtcPeerEvents.OnFailure = new WebrtcPeerStringEvent()

Event that occurs when a peer-specific failure happens

◆ OnIceCandiateReadyToSend

WebrtcPeerStringIntStringEvent UnityWebrtc.WebrtcPeerEvents.OnIceCandiateReadyToSend = new WebrtcPeerStringIntStringEvent()

Event that occurs when an ice candidate is prepared

◆ OnLocalDataChannelReady

UnityEvent UnityWebrtc.WebrtcPeerEvents.OnLocalDataChannelReady = new UnityEvent()

Event that occurs when the data channel is ready

◆ OnLocalSdpReadyToSend

WebrtcPeerString2Event UnityWebrtc.WebrtcPeerEvents.OnLocalSdpReadyToSend = new WebrtcPeerString2Event()

Event that occurs when an sdp message is prepared

◆ OnPeerReady

UnityEvent UnityWebrtc.WebrtcPeerEvents.OnPeerReady = new UnityEvent()

Event that occurs when the peer is ready

This is the same as Webrtc.OnInitialized but is included here for convienience

◆ OnSdpAnswerReadyToSend

WebrtcPeerStringEvent UnityWebrtc.WebrtcPeerEvents.OnSdpAnswerReadyToSend = new WebrtcPeerStringEvent()

Event that occurs when an sdp answer is prepared

◆ OnSdpOfferReadyToSend

WebrtcPeerStringEvent UnityWebrtc.WebrtcPeerEvents.OnSdpOfferReadyToSend = new WebrtcPeerStringEvent()

Event that occurs when an sdp offer is prepared


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