Exemplo n.º 1
0
 public static void RegisterIceServer(WebRtcConfig config)
 {
     foreach (var vv in config.iceServers)
     {
         LibWebrtc.RegisterIceServer(vv.url, vv.username, vv.credential);
     }
 }
Exemplo n.º 2
0
        public DataChannel CreateDataChannel()
        {
            int channelAddr = LibWebrtc.CreateDataChannel(this.onChannelStateChanged_Callback_Handle, this.onChannelMessage_Callback_Handle, _connectionAddr);
            var newChannel  = new DataChannel(channelAddr, this._connectionAddr);

            _channels.Add(newChannel);
            return(newChannel);
        }
Exemplo n.º 3
0
        public static PeerConnection NewPeerConnection(bool isVedio, string vedioName, int vedioIndex, bool isAudio, string audioName, int audioIndex)
        {
            var connectionAddr = LibWebrtc.NewConnection(isVedio, vedioName, vedioIndex, isAudio, audioName, audioIndex);
            var connection     = new PeerConnection(connectionAddr);

            _allConnections.Add(connection);
            return(connection);
        }
Exemplo n.º 4
0
        public static List <AudioDevice> GetAllPlayoutAudioDevices()
        {
            List <AudioDevice> playoutDevices = new List <AudioDevice>();
            var audioCount = LibWebrtc.GetPlayoutAudioDeviceNumber();

            for (int i = 0; i < audioCount; i++)
            {
                AudioDevice audio = new AudioDevice(true);
                LibWebrtc.GetPlayoutAudioDevice(i, ref audio);
                playoutDevices.Add(audio);
            }
            return(playoutDevices);
        }
Exemplo n.º 5
0
        public static List <AudioDevice> GetAllRecordingAudioDevices()
        {
            List <AudioDevice> recordingDevices = new List <AudioDevice>();
            var audioCount = LibWebrtc.GetRecordingAudioDeviceNumber();

            for (int i = 0; i < audioCount; i++)
            {
                AudioDevice audio = new AudioDevice(true);
                LibWebrtc.GetRecordingAudioDevice(i, ref audio);
                recordingDevices.Add(audio);
            }
            return(recordingDevices);
        }
Exemplo n.º 6
0
        public static List <VedioDevice> GetAllVedioDevices()
        {
            List <VedioDevice> vedios = new List <VedioDevice>();
            var vedioCount            = LibWebrtc.GetVideoDeviceNumber();

            for (int i = 0; i < vedioCount; i++)
            {
                VedioDevice vedio = new VedioDevice(true);
                LibWebrtc.GetVideoDevice(i, ref vedio);
                vedios.Add(vedio);
            }
            return(vedios);
        }
Exemplo n.º 7
0
        public PeerConnection(int connectionAddr)
        {
            _connectionAddr = connectionAddr;

            this.onAddStream_Callback_Handle          = new onAddStream_Callback(this.onAddStream_Callback);
            this.onAddTrack_Callback_Hanle            = new onAddTrack_Callback(this.onAddTrack_Callback);
            this.onDataChannel_Callback_Handle        = new onDataChannel_Callback(this.onDataChannel_Callback);
            this.onIceCandidate_Callback_Handle       = new onIceCandidate_Callback(this.onIceCandidate_Callback);
            this.onIceConnectionState_Callback_Handle = new onIceConnectionState_Callback(this.onIceConnectionState_Callback);
            this.onIceGatheringState_Callback_Handle  = new onIceGatheringState_Callback(this.onIceGatheringState_Callback);
            this.onRemoveStream_Callback_Handle       = new onRemoveStream_Callback(this.onRemoveStream_Callback);
            this.onRemoveTrack_Callback_Handle        = new onRemoveTrack_Callback(this.onRemoveTrack_Callback);
            this.onSignalingState_Callback_Handle     = new onSignalingState_Callback(this.onSignalingState_Callback);
            this.onLocalFrame_Callback_Handle         = new onFrame_Callback(this.onLocalFrame_Callback);
            this.onRemoteFrame_Callback_Handle        = new onFrame_Callback(this.onRemoteFrame_Callback);

            LibWebrtc.SetListenerAddStream(this.onAddStream_Callback_Handle, this._connectionAddr);
            LibWebrtc.SetListenerAddTrack(this.onAddTrack_Callback_Hanle, this._connectionAddr);
            LibWebrtc.SetListenerDataChannel(this.onDataChannel_Callback_Handle, this._connectionAddr);
            LibWebrtc.SetListenerIceCandidate(this.onIceCandidate_Callback_Handle, this._connectionAddr);
            LibWebrtc.SetListenerIceConnectionState(this.onIceConnectionState_Callback_Handle, this._connectionAddr);
            LibWebrtc.SetListenerIceGatheringState(this.onIceGatheringState_Callback_Handle, this._connectionAddr);
            LibWebrtc.SetListenerRemoveStream(this.onRemoveStream_Callback_Handle, this._connectionAddr);
            LibWebrtc.SetListenerRemoveTrack(this.onRemoveTrack_Callback_Handle, this._connectionAddr);
            LibWebrtc.SetListenerSignalingState(this.onSignalingState_Callback_Handle, this._connectionAddr);
            LibWebrtc.SetListenonLocalFrame(this.onLocalFrame_Callback_Handle, this._connectionAddr);
            LibWebrtc.SetListenonRemoteFrame(this.onRemoteFrame_Callback_Handle, this._connectionAddr);

            this.offerCreateFailure_Callback_Handle          = new sdpCreateFailure_Callback(this.offerCreateFailure_Callback);
            this.offerCreateSuccess_Callback_Handle          = new sdpCreateSuccess_Callback(this.offerCreateSuccess_Callback);
            this.answerCreateSuccess_Callback_Handle         = new sdpCreateSuccess_Callback(this.answerCreateSuccess_Callback);
            this.answerCreateFailure_Callback_Handle         = new sdpCreateFailure_Callback(this.answerCreateFailure_Callback);
            this.setLocalDescriptionFailure_Callback_Handle  = new setSdpFailure_Callback(this.setLocalDescriptionFailure_Callback);
            this.setLocalDescriptionSuccess_Callback_Handle  = new setSdpSuccess_Callback(this.setLocalDescriptionSuccess_Callback);
            this.setRemoteDescriptionFailure_Callback_Handle = new setSdpFailure_Callback(this.setRemoteDescriptionFailure_Callback);
            this.setRemoteDescriptionSuccess_Callback_Handle = new setSdpSuccess_Callback(this.setRemoteDescriptionSuccess_Callback);
            this.onChannelStateChanged_Callback_Handle       = new onChannelStateChanged_Callback(this.onChannelStateChanged_Callback);
            this.onChannelMessage_Callback_Handle            = new onChannelMessage_Callback(this.onChannelMessage_Callback);
        }
Exemplo n.º 8
0
 public void SetRemoteDescription(string sdp, string type)
 {
     LibWebrtc.SetRemoteDescription(sdp, type, this.setRemoteDescriptionSuccess_Callback_Handle, this.setRemoteDescriptionFailure_Callback_Handle, _connectionAddr);
 }
Exemplo n.º 9
0
 public void CreateAnswer()
 {
     LibWebrtc.CreateAnswer(this.answerCreateSuccess_Callback_Handle, this.answerCreateFailure_Callback_Handle, _connectionAddr);
 }
Exemplo n.º 10
0
 static void Dispose()
 {
     LibWebrtc.Dispose();
 }
Exemplo n.º 11
0
 static WebrtcClass()
 {
     LibWebrtc.Initialize();
 }
Exemplo n.º 12
0
 public void SendChannelData(string data)
 {
     LibWebrtc.SendChannelData(this._connectionAddr, this._channelAddr, data);
 }