예제 #1
0
 public ListviewVideoSubscription(VideoSubscription videoSubscription)
 {
     this._videoSubscription = videoSubscription;
     this.Text = videoSubscription.Name;
     this.SubItems.Add(videoSubscription.Provider);
     this.SubItems.Add(videoSubscription.Slug);
 }
예제 #2
0
        /// <summary>
        /// Subscribe to the video stream of a participant. This function is called when dominant speaker notification is received and when roster changes
        /// When invoked on dominant speaker change, look if the participant is sharing their video. If yes then subscribe else choose the first participant in the list sharing their video
        /// When invoked on roster change, verify if the previously subscribed-to participant is still in the roster and sending video
        /// </summary>
        /// <param name="msi">Msi of dominant speaker or previously subscribed to msi depending on where it is invoked</param>
        /// <param name="msiOfDominantSpeaker">Gives more detail on the above msi.. Whether it is of dominant speaker or previously subscribed to video msi</param>
        /// <returns></returns>
        internal async Task Subscribe(uint msi, bool msiOfDominantSpeaker)
        {
            try
            {
                RosterParticipant participant;
                Log.Info(new CallerInfo(), LogContext.FrontEnd, $"[{CallId}] Received subscribe request for Msi {msi} msiOfDominantSpeaker {msiOfDominantSpeaker}");
                if (msiOfDominantSpeaker)
                {
                    participant = GetParticipantWithDominantSpeakerMsi(msi);
                }
                else
                {
                    participant = GetParticipantForRosterChange(msi);
                }

                if (participant == null)
                {
                    _subscribedToParticipant = null;
                    return;
                }

                //if we have already subscribed earlier, skip the subscription
                if (_subscribedToParticipant != null && _subscribedToParticipant.MediaStreamId == participant.MediaStreamId)
                {
                    Log.Info(new CallerInfo(), LogContext.FrontEnd, $"[{CallId}] Already subscribed to {participant.Identity}. So skipping subscription");
                    return;
                }

                Log.Info(new CallerInfo(), LogContext.FrontEnd, $"[{CallId}] Subscribing to {participant.Identity} with msi {participant.MediaStreamId}");

                //Get subscription details
                var videoSubscription = new VideoSubscription
                {
                    ParticipantIdentity = participant.Identity,
                    OperationId         = Guid.NewGuid().ToString(),
                    SocketId            = 0,        //index of the VideoSocket in MediaConfiguration which receives the incoming video stream
                    VideoModality       = ModalityType.Video,
                    VideoResolution     = ResolutionFormat.Hd1080p
                };

                await CallService.Subscribe(videoSubscription).ConfigureAwait(false);

                _subscribedToParticipant = participant;
            }
            catch (Exception ex)
            {
                Log.Error(new CallerInfo(), LogContext.FrontEnd, $"[{CallId}] Subscribe threw exception {ex.ToString()}");
                _subscribedToParticipant = null;
            }
        }
        /// <summary>
        /// Subscribe to a video or video based screen sharing channel
        /// </summary>
        /// <param name="videoSubscription"></param>
        /// <returns></returns>
        public async Task Subscribe(VideoSubscription videoSubscription)
        {
            if (_subscriptionLink == null)
            {
                throw new InvalidOperationException($"[{CallLegId}]: No subscription link was present in the AnswerAppHostedMediaOutcome");
            }

            videoSubscription.Validate();
            HttpContent content = new StringContent(RealTimeMediaSerializer.SerializeToJson(videoSubscription), Encoding.UTF8, JSONConstants.ContentType);

            //Subscribe
            try
            {
                Trace.TraceInformation(
                    $"RealTimeMediaCallService [{CallLegId}]: Sending subscribe request for " +
                    $"user: {videoSubscription.ParticipantIdentity}" +
                    $"subscriptionLink: {_subscriptionLink}");

                //TODO: add retries & logging
                using (var request = new HttpRequestMessage(HttpMethod.Put, _subscriptionLink)
                {
                    Content = content
                })
                {
                    request.Headers.Add("X-Microsoft-Skype-Chain-ID", CorrelationId);
                    request.Headers.Add("X-Microsoft-Skype-Message-ID", Guid.NewGuid().ToString());

                    var client   = GetHttpClient();
                    var response = await client.SendAsync(request).ConfigureAwait(false);

                    response.EnsureSuccessStatusCode();

                    Trace.TraceInformation($"RealTimeMediaCallService [{CallLegId}]: Response to subscribe: {response}");
                }
            }
            catch (Exception exception)
            {
                Trace.TraceError($"RealTimeMediaCallService [{CallLegId}]: Received error while sending request to subscribe participant. Message: {exception}");
                throw;
            }
        }
예제 #4
0
파일: Youtube.cs 프로젝트: w0pr/blizztv
 public Youtube(VideoSubscription subscription)
     : base(subscription)
 {
 }