/// <summary> /// Create and start AV session with remote Uri /// </summary> /// <param name="remoteUri"></param> public void StartAVSession(string avRemoteUri) { this.avRemoteUri = avRemoteUri; // Create AV session CreateSession(UCC_SESSION_TYPE.UCCST_AUDIO_VIDEO); // Create remote participant UccUriManager uriManager = new UccUriManager(); IUccSessionParticipant participant = this.avSession.CreateParticipant(uriManager.ParseUri(this.avRemoteUri), null); IUccAudioVideoSessionParticipant avParticipant = participant as IUccAudioVideoSessionParticipant; // Create audio channel IUccMediaChannel channel = avParticipant.CreateChannel(UCC_MEDIA_TYPES.UCCMT_AUDIO, null); channel.PreferredMedia = (int)(UCC_MEDIA_DIRECTIONS.UCCMD_RECEIVE | UCC_MEDIA_DIRECTIONS.UCCMD_SEND); // Add channel avParticipant.AddChannel(channel); UccOperationContext context = new UccOperationContextClass(); context.Initialize(operationId++, null); // Add remote participant this.avSession.AddParticipant(participant, context); }
protected override void OnParticipantAdded(IUccSession eventSource, IUccSessionParticipant participant) { base.OnParticipantAdded(eventSource, participant); IUccAudioVideoSessionParticipant avParticipant = participant as IUccAudioVideoSessionParticipant; foreach (IUccMediaChannel channel in avParticipant.Channels) { this.OnChannelAdded(avParticipant, channel); } ComEvents.Advise <_IUccMediaChannelCollectionEvents>(avParticipant, this); }
protected T FindMediaChannel <T>(IUccAudioVideoSessionParticipant participant) { if (typeof(T) == typeof(IUccVideoMediaChannel)) { return((T)this.FindMediaChannel(participant, UCC_MEDIA_TYPES.UCCMT_VIDEO)); } if (typeof(T) == typeof(IUccAudioMediaChannel)) { return((T)this.FindMediaChannel(participant, UCC_MEDIA_TYPES.UCCMT_AUDIO)); } return(default(T)); }
protected IUccMediaChannel FindMediaChannel(IUccAudioVideoSessionParticipant participant, UCC_MEDIA_TYPES mediaType) { if (participant != null) { foreach (IUccMediaChannel channel in participant.Channels) { if ((channel.MediaType & mediaType) == mediaType) { return(channel); } } } return(null); }
protected override void AddChannel(IUccSessionParticipant participant) { IUccAudioVideoSessionParticipant avParticipant = participant as IUccAudioVideoSessionParticipant; IUccMediaChannel audioChannel = avParticipant.CreateChannel(UCC_MEDIA_TYPES.UCCMT_AUDIO, null); audioChannel.PreferredMedia = (int)(UCC_MEDIA_DIRECTIONS.UCCMD_RECEIVE | UCC_MEDIA_DIRECTIONS.UCCMD_SEND); avParticipant.AddChannel(audioChannel); if (this.isVideoEnabled) { IUccMediaChannel videoChannel = avParticipant.CreateChannel(UCC_MEDIA_TYPES.UCCMT_VIDEO, null); videoChannel.PreferredMedia = (int)(UCC_MEDIA_DIRECTIONS.UCCMD_RECEIVE | UCC_MEDIA_DIRECTIONS.UCCMD_SEND); avParticipant.AddChannel(videoChannel); } }
void _IUccMediaChannelCollectionEvents.OnChannelRemoved(IUccAudioVideoSessionParticipant eventSource, IUccMediaChannelCollectionEvent eventData) { ComEvents.Unadvise <_IUccMediaChannelEvents>(eventData.MediaChannel, this); }
void _IUccMediaChannelCollectionEvents.OnChannelAdded(IUccAudioVideoSessionParticipant eventSource, IUccMediaChannelCollectionEvent eventData) { this.OnChannelAdded(eventSource, eventData.MediaChannel); }
protected virtual void OnChannelAdded(IUccAudioVideoSessionParticipant eventSource, IUccMediaChannel channel) { this.OnNegotiatedMediaChanged(channel, 0, (UCC_MEDIA_DIRECTIONS)channel.NegotiatedMedia); ComEvents.Advise <_IUccMediaChannelEvents>(channel, this); }