/// <summary> /// Initializes the video handlers (camera, image providers etc.). /// </summary> private void InitVideo() { // ----- CREATE ----- WebCamera = WebCamera.GetDefaultDevice(); LocalImageProvider = new BitmapSourceProvider(); RemoteImageProvider = new BitmapSourceProvider(); phoneCallVideoReceiver = new PhoneCallVideoReceiver(); phoneCallVideoSender = new PhoneCallVideoSender(); // ----- CONNECT ----- videoConnector.Connect(phoneCallVideoReceiver, RemoteImageProvider); if (WebCamera != null) { videoConnector.Connect(WebCamera, LocalImageProvider); videoConnector.Connect(WebCamera, phoneCallVideoSender); } // add to collection Dictionary <string, VoIPMediaHandler> collection = new Dictionary <string, VoIPMediaHandler>(); collection.Add("LocalImageProvider", LocalImageProvider); collection.Add("RemoteImageProvider", RemoteImageProvider); collection.Add("PhoneCallVideoReceiver", phoneCallVideoReceiver); collection.Add("PhoneCallVideoSender", phoneCallVideoSender); videoCollection = new MediaHandlerCollection(videoConnector, collection); }
public MediaHandlerCollection CreateSoftPhoneVideoCallListener() { var phonecallVideoReceiver = new PhoneCallVideoReceiver(); var phonecallVideoSender = new PhoneCallVideoSender(); ImageProvider <Image> remoteImageHandler = new DrawingImageProvider(); ImageProvider <Image> localImageHandler = new DrawingImageProvider(); var webCamera = WebCamera.GetDefaultDevice(); if (webCamera != null) { mediaConnector.Connect(webCamera, phonecallVideoSender); mediaConnector.Connect(webCamera, localImageHandler); } mediaConnector.Connect(phonecallVideoReceiver, remoteImageHandler); var mediaHandlers = new Dictionary <string, VoIPMediaHandler> { { "RemoteImageHandler", remoteImageHandler }, { "LocalImageHandler", localImageHandler }, { "VideoSender", phonecallVideoSender }, { "VideoReceiver", phonecallVideoReceiver } }; if (webCamera != null) { mediaHandlers.Add("WebCamera", webCamera); } return(new MediaHandlerCollection(mediaConnector, mediaHandlers)); }
/// <summary> /// Initializes the video handlers (camera, image providers etc.). /// </summary> private void InitVideo() { // ----- CREATE ----- WebCamera = WebCameraFactory.GetDefaultDevice(); LocalImageProvider = new DrawingImageProvider(); RemoteImageProvider = new DrawingImageProvider(); _phoneCallVideoReceiver = new PhoneCallVideoReceiver(); _phoneCallVideoSender = new PhoneCallVideoSender(); // ----- CONNECT ----- _videoConnector.Connect(_phoneCallVideoReceiver, RemoteImageProvider); if (WebCamera != null) { _videoConnector.Connect(WebCamera.VideoChannel, LocalImageProvider); _videoConnector.Connect(WebCamera.VideoChannel, _phoneCallVideoSender); } }
/// <summary> /// Initializes the video handlers (camera, image providers etc.). /// </summary> private void InitVideo() { // ----- CREATE ----- WebCamera = WebCamera.GetDefaultDevice(); LocalImageProvider = new BitmapSourceProvider(); RemoteImageProvider = new BitmapSourceProvider(); phoneCallVideoReceiver = new PhoneCallVideoReceiver(); phoneCallVideoSender = new PhoneCallVideoSender(); // ----- CONNECT ----- videoConnector.Connect(phoneCallVideoReceiver, RemoteImageProvider); if (WebCamera != null) { videoConnector.Connect(WebCamera, LocalImageProvider); videoConnector.Connect(WebCamera, phoneCallVideoSender); } // add to collection Dictionary<string, VoIPMediaHandler> collection = new Dictionary<string, VoIPMediaHandler>(); collection.Add("LocalImageProvider", LocalImageProvider); collection.Add("RemoteImageProvider", RemoteImageProvider); collection.Add("PhoneCallVideoReceiver", phoneCallVideoReceiver); collection.Add("PhoneCallVideoSender", phoneCallVideoSender); videoCollection = new MediaHandlerCollection(videoConnector, collection); }
public MediaHandlerCollection CreateSoftPhoneVideoCallListener() { var phonecallVideoReceiver = new PhoneCallVideoReceiver(); var phonecallVideoSender = new PhoneCallVideoSender(); ImageProvider<Image> remoteImageHandler = new DrawingImageProvider(); ImageProvider<Image> localImageHandler = new DrawingImageProvider(); var webCamera = WebCamera.GetDefaultDevice(); if (webCamera != null) { mediaConnector.Connect(webCamera, phonecallVideoSender); mediaConnector.Connect(webCamera, localImageHandler); } mediaConnector.Connect(phonecallVideoReceiver, remoteImageHandler); var mediaHandlers = new Dictionary<string, VoIPMediaHandler> { {"RemoteImageHandler", remoteImageHandler}, {"LocalImageHandler", localImageHandler}, {"VideoSender", phonecallVideoSender}, {"VideoReceiver", phonecallVideoReceiver} }; if (webCamera != null) { mediaHandlers.Add("WebCamera", webCamera); } return new MediaHandlerCollection(mediaConnector, mediaHandlers); }
/// <summary> /// Creates the incoming and outgoing media handlers such as microphone or speaker /// </summary> private void CreateMediaHandlers() { MediaHandlerFactory factory = new MediaHandlerFactory(); activeAudioCallListener = factory.CreateSoftPhoneCallListener(); activeVideoCallListener = factory.CreateSoftPhoneVideoCallListener(); phoneCallAudioReceiver = activeAudioCallListener.GetComponent("AudiReceiver") as PhoneCallAudioReceiver; phoneCallAudioSender = activeAudioCallListener.GetComponent("AudioSender") as PhoneCallAudioSender; phonecallVideoSender = activeVideoCallListener.GetComponent("VideoSender") as PhoneCallVideoSender; phonecallVideoReceiver = activeVideoCallListener.GetComponent("VideoReceiver") as PhoneCallVideoReceiver; mediaConnector = activeAudioCallListener.MediaConnector; microphone = activeAudioCallListener.GetComponent("Microphone") as Microphone; if (microphone != null) { microphone.LevelChanged += (Microphone_LevelChanged); } speaker = activeAudioCallListener.GetComponent("Speaker") as Speaker; if (speaker != null) { speaker.LevelChanged += (Speaker_LevelChanged); } incomingDataMixer = activeAudioCallListener.GetComponent("SpeakerMixer") as AudioMixerMediaHandler; camera = activeVideoCallListener.GetComponent("WebCamera") as WebCamera; remoteImageHandler = activeVideoCallListener.GetComponent("RemoteImageHandler") as ImageProvider<Image>; localImageHandler = activeVideoCallListener.GetComponent("LocalImageHandler") as ImageProvider<Image>; AudioProcessor = activeAudioCallListener.GetComponent("AudioProcessor") as AudioQualityEnhancer; outgoingDataMixer = activeAudioCallListener.GetComponent("OutGoingDataMixer") as AudioMixerMediaHandler; RecordDataMixer = activeAudioCallListener.GetComponent("RecordDataMixer") as AudioMixerMediaHandler; dtmfEventWavePlayer = activeAudioCallListener.GetComponent("DTMF") as DtmfEventWavePlayer; ringtoneWavePlayer = activeAudioCallListener.GetComponent("Ringtones") as PhoneCallStateWavePlayer; Stream basicRing = Assembly.GetExecutingAssembly().GetManifestResourceStream( "OzekiDemoSoftphone.Resources.basic_ring.wav" ); ringtoneWavePlayer.UpdateIncomingStateStream(CallState.Ringing, @"..\..\Resources\basic_ring.wav"); ringtoneWavePlayer.UpdateOutgoingStateStream(CallState.Ringing, @"..\..\Resources\ringback.wav"); }