Show / Hide Table of Contents

Class RTCControl

The RTCControl is a .NET WPF Control that facilitates the creation of .NET based video conferencing applications that use the WebRTC standards for communication

Inheritance
System.Object
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Media.Visual
System.Windows.UIElement
System.Windows.FrameworkElement
System.Windows.Controls.Control
System.Windows.Controls.ContentControl
System.Windows.Controls.UserControl
RTCControl
Namespace: iConfRTCWPF
Assembly: iConfRTCWPF.dll
Syntax
public class RTCControl : UserControl, DUCE.IResource, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IHaveResources, IQueryAmbient, IAddChild, IComponentConnector

Constructors

RTCControl()

Declaration
public RTCControl()

Fields

tempFilePath

Declaration
protected string tempFilePath
Field Value
Type Description
System.String

Properties

isFullScreen

returns true of the RTC Control is operating in Full Screen mode/ False otherwise. To Toggle the full screen mode, refer to ToggleFullScreen()

Declaration
public bool isFullScreen { get; }
Property Value
Type Description
System.Boolean

LogFilePath

The full path include file name to which the log should be written example c:\temp\log.txt

Declaration
public string LogFilePath { get; set; }
Property Value
Type Description
System.String

LoggingEnabled

Set this to true to Enable File Logging

Declaration
public bool LoggingEnabled { get; set; }
Property Value
Type Description
System.Boolean

MyMeetingID

My current Meeting ID updated to MyMeetingID on 3/11/2018 to match the iConfRTC Windows Forms control

Declaration
public string MyMeetingID { get; set; }
Property Value
Type Description
System.String

MySession

The ID that can be used to view me

Declaration
public string MySession { get; set; }
Property Value
Type Description
System.String

MyUserName

The user name assigned to the iConfRTC Control and that was used to join the meeting

Declaration
public string MyUserName { get; set; }
Property Value
Type Description
System.String

SharingMedia

True if currently sharing amedia file or url

Declaration
public bool SharingMedia { get; set; }
Property Value
Type Description
System.Boolean

SignalingType

The type of signaling server that the iConfRTC Control will be connecting to 1 for socket.io 2 for signalr refer to SignalingTypes

Declaration
public int SignalingType { get; set; }
Property Value
Type Description
System.Int32

SignalingUrl

Establishing a WebRTC connection between two devices over the Internet requires the use of a signaling server to figure out how to connect them.

SignalingUrl represents the URL and port of the Signaling Server.

Please note that we provide two implementations of a signaling server with the iConfRTC SDK, both of which you can host yourself:

  1. A SignalR based one (Windows Service)
  2. A node.js server that uses socket.io for communication

Example SignalingUrl if you are using SignalR :

http://[your_server_address]:[listening_port]/signalr/hubs

http://192.168.2.3:8081/signalr/hubs
Declaration
public string SignalingUrl { get; set; }
Property Value
Type Description
System.String

Methods

AddIceServer(String, String, String, String, Boolean)

Interactive Connectivity Establishment (ICE) Protocol is used for NAT transversal. ICE uses a combination of methods including Session Traversal Utility for NAT (STUN) and Traversal Using Relay NAT (TURN). The presence of a Network Address Translator (NAT) presents problems for Voice over IP (VoIP) and WebRTC implementations.

Declaration
public void AddIceServer(string url, string type, string userName = "", string password = "", bool clearFirst = false)
Parameters
Type Name Description
System.String url

The url (address) of the STUN or TURN server

System.String type

the type of server turn or stun

System.String userName

the user name that should be used for authentication

System.String password

the password that should be used for authentication

System.Boolean clearFirst

clear list of servers prior to adding this server

ClearIceServers()

Declaration
public void ClearIceServers()

InitializeComponent()

InitializeComponent

Declaration
public void InitializeComponent()

JoinMeeting(String, String)

Join a meeting. If the meeting does not exist, it will be created

Declaration
public void JoinMeeting(string userName, string meetingId)
Parameters
Type Name Description
System.String userName

your user identifier

System.String meetingId

the id of the meeting you would like to join or create

Examples
iconfRTC.JoinMeeting("myuser", "room1");

LeaveMeeting()

Use this function to Leave a meeting that was joined using the JoinMeeting function

Declaration
public void LeaveMeeting()
See Also
JoinMeeting(String, String)

MuteAudio(Boolean)

Mute un-mute audio stream

Declaration
public void MuteAudio(bool mute)
Parameters
Type Name Description
System.Boolean mute

true to mute, false to unmute

MuteVideo(Boolean)

Mute/Un-mute video stream

Declaration
public void MuteVideo(bool mute)
Parameters
Type Name Description
System.Boolean mute

true to mute, false to unmute

RecordStream(Boolean, Boolean)

Declaration
public void RecordStream(bool video, bool audio)
Parameters
Type Name Description
System.Boolean video
System.Boolean audio

RtcInter()

Declaration
protected void RtcInter()

SelectDevice(String, DeviceType)

Select the Video or Audio Device that will be used during the meeting. This function should be called before joining the meeting (JoinMeeting).

Declaration
public void SelectDevice(string audioOrVideoDevice, DeviceType deviceType)
Parameters
Type Name Description
System.String audioOrVideoDevice

the audio or video device ID

DeviceType deviceType

The device type 1 for Video , 2 for Audio ( Use DeviceType enum )

SelectDevice(String, String)

Select the Video / Audio Device that will be used during the meeting. This function should be called before joining the meeting (JoinMeeting). For device identifiers you can pass the label of the device or the Id for the device note that we have seen cases where device ids change, so the device id is not 100% reliable check the NewDevices event to capture the label and Id of the device

Declaration
public void SelectDevice(string audioDevice, string videoDevice)
Parameters
Type Name Description
System.String audioDevice

the audio device ID or label

System.String videoDevice

the video device ID or label example of label if you have a Logitech HD Pro Webcam C920 "HD Pro Webcam C920 (046d:082d)"

SendMessageToMeeting(String)

Send a message to the meeting the current user is in

Declaration
public void SendMessageToMeeting(string message)
Parameters
Type Name Description
System.String message
Examples

iconfRTC.SendMessageToMeeting("hello!");

SetMutePoster(String)

Used in conjuntion with the MuteVideo function sets an image that will be displayed in lieue of the video stream while the stream is muted

Declaration
public void SetMutePoster(string posterData)
Parameters
Type Name Description
System.String posterData

base 64 image data that will be displayed to those who are viewing the session

See Also
SetMutePoster(Image)

SetMutePoster(Image)

Used in conjuntion with the MuteVideo function sets an image that will be displayed in lieue of the video stream while the stream is muted

Declaration
public void SetMutePoster(Image posterImage)
Parameters
Type Name Description
System.Windows.Controls.Image posterImage

the image that will be displayed to those who are viewing the session

See Also
SetMutePoster(String)

ShareMedia(String)

Share a media file

Declaration
public void ShareMedia(string fileName)
Parameters
Type Name Description
System.String fileName

the path to teh file ( can also be a url

ShowDev()

Declaration
public void ShowDev()

StartVideo()

Starts streaming video from the webcam Preferably, you would Join the meeting then give the option to start the video after joining the meeting

Declaration
public void StartVideo()

StopRecordingStream(Boolean)

Declaration
public void StopRecordingStream(bool showSaveDialog)
Parameters
Type Name Description
System.Boolean showSaveDialog

StopVideo()

Stops streamingvideo from the webcam

Declaration
public void StopVideo()

ToggleFullScreen()

Toggles the full screen operation of the RTC Control

Declaration
public void ToggleFullScreen()

ViewSession(String, String)

Access a user session video and audio

Example scenario

user1 joins a meeting with meeting ID of room1

user2 joins the same meeting room1

The UserJoinedMeeting events gets fired on both sides for user1 and user2

Inside the UserJoinedMeeting event, you can use the ViewSession function to View any of the meeting participants ( the list of participants can be accessed right from the arguments of the UserJoinedMeeting event ).

Declaration
public void ViewSession(string userName, string session)
Parameters
Type Name Description
System.String userName
System.String session

session id

Examples
        private void IconfRTC_UserJoinedMeeting(object sender, UserArgs e)
      {
          ProcessParticipants(e.Participants);
      }
      private void ProcessParticipants(List<MeetingParticipants> participants)
      {
          //when a user joins a meeting we receive a list of meeting participants ( including yourself )
          //we go through the list , create viewers (RTCControls) for each participant and call ViewSession,
          //passing along the participant's sessionId
          foreach (var participant in participants)
          {
              if (participant.Session != iconfRTC.MySession) //you are already seeing yourself :)
              {
                  bool sessionExists = currParticipants.Any(p => p.Session == participant.Session);
                  if (!sessionExists)
                  {
                      var viewer = new RTCControl
                      {
                          SignalingType = SignalingTypes.Socketio,
                          SignalingUrl = iconfRTC.SignalingUrl,
                          Dock = DockStyle.Fill
                      };
                      var pnlViewerParent = new Panel
                      {
                          Tag = participant.Session,
                          Width = 480,
                          Height = 360
                      };

                      pnlViewerParent.Controls.Add(viewer);
                      pnlViewerParent.Visible = true;
                      pnlLayout.Controls.Add(pnlViewerParent);
                      currParticipants.Add(new CurrentParticipants { Session = participant.Session, UserName = participant.UserName, PanelLayout = pnlViewerParent, RTCControl = viewer });

                      //only call webrtc functions when WebRTC is ready!!
                      viewer.RTCInitialized += (((object a) =>
                      {
                          // viewer.AddIceServer(url: "numb.viagenie.ca", userName: "support@avspeed.com", password: "avspeedwebrtc", clearFirst: false, type: "turn");
                          //viewer.AddIceServer("stun.voiparound.com");
                          //webrtc is ready, connect to signaling
                          viewer.ViewSession(participant.Session);
                      }));
                  }
              }
          }
      }

Events

ConnectedToSignaling

Declaration
public event RTCControl.ConnectedToSignalingDelegate ConnectedToSignaling
Event Type
Type Description
iConfRTCWPF.RTCControl.ConnectedToSignalingDelegate

ErrorConnectSignaling

Declaration
public event RTCControl.ErrorConnectSignalingDelegate ErrorConnectSignaling
Event Type
Type Description
iConfRTCWPF.RTCControl.ErrorConnectSignalingDelegate

IJoinedMeeting

The IJoinedMeeting event is fired when a you successfully join a meeting using the JoinMeeting function

Declaration
public event RTCControl.IJoinedMeetingDelegate IJoinedMeeting
Event Type
Type Description
iConfRTCWPF.RTCControl.IJoinedMeetingDelegate

ILeftMeeting

The ILeftMeeting event is fired when a you leave a meeting that was joined using the JoinMeeting function

Declaration
public event RTCControl.ILeftMeetingDelegate ILeftMeeting
Event Type
Type Description
iConfRTCWPF.RTCControl.ILeftMeetingDelegate

MeetingMessageReceived

The MeetingMessageReceived event is fired when you a Message sent to the meeting is received

Declaration
public event RTCControl.MeetingMessageReceivedDelegate MeetingMessageReceived
Event Type
Type Description
iConfRTCWPF.RTCControl.MeetingMessageReceivedDelegate

NewDevices

The NewDevices event is fired when devices are found and ready to be enumerated

Declaration
public event RTCControl.NewDevicesDelegate NewDevices
Event Type
Type Description
iConfRTCWPF.RTCControl.NewDevicesDelegate

RTCInitialized

Fired when the WebRTC engine has been initialized and is ready to be used

Declaration
public event RTCControl.RTCInitializedDelegate RTCInitialized
Event Type
Type Description
iConfRTCWPF.RTCControl.RTCInitializedDelegate

UserJoinedMeeting

The UserJoinedMeeting event is fired when a new user joins a meeting that was joined using the JoinMeeting function

Declaration
public event RTCControl.UserJoinedMeetingDelegate UserJoinedMeeting
Event Type
Type Description
iConfRTCWPF.RTCControl.UserJoinedMeetingDelegate

UserLeftMeeting

The UserLeftMeeting event is fired when a user leaves a meeting that was joined using the JoinMeeting function

Declaration
public event RTCControl.UserLeftMeetingDelegate UserLeftMeeting
Event Type
Type Description
iConfRTCWPF.RTCControl.UserLeftMeetingDelegate
Back to top Generated by DocFX