public IntPtr OnAuxStreamAvailable() { Output($"OnAuxStreamAvailable, Total Count:{CurrentCall.AvailableAuxStreamCount}"); var idleView = AuxStreamViews.FirstOrDefault(x => !x.IsInUse); if (idleView == null) { return(IntPtr.Zero); } idleView.IsInUse = true; // SDK will open this auxiliary stream with this view and the result will be notified by AuxStreamOpenedEvent. return(idleView.Handle); }
public void OnAuxStreamEvent(AuxStreamEvent auxStreamEvent) { if (auxStreamEvent is AuxStreamOpenedEvent auxStreamOpenedEvent) { var handle = auxStreamOpenedEvent.Result.Data; var view = AuxStreamViews.FirstOrDefault(x => x.Handle == handle); if (view != null) { if (auxStreamOpenedEvent.Result.IsSuccess) { // Display this view. view.IsInUse = true; view.IsShow = true; Output($"AuxStreamOpenedEvent: {view.Name}"); } else { view.IsInUse = false; Output($"{auxStreamOpenedEvent.Result.Error.ErrorCode}, Reason:{auxStreamOpenedEvent.Result.Error.Reason}"); } } } else if (auxStreamEvent is AuxStreamClosedEvent auxStreamClosedEvent) { var handle = auxStreamClosedEvent.Result.Data; var view = AuxStreamViews.FirstOrDefault(x => x.Handle == handle); if (view != null) { if (auxStreamClosedEvent.Result.IsSuccess) { // Hide this view. view.IsInUse = false; view.IsShow = false; Output($"AuxStreamClosedEvent: {view.Name}"); } else { view.IsInUse = true; Output($"{auxStreamClosedEvent.Result.Error.ErrorCode}, Reason:{auxStreamClosedEvent.Result.Error.Reason}"); } } } else if (auxStreamEvent is AuxStreamPersonChangedEvent personChangedEvent) { var auxStream = personChangedEvent.AuxStream; var find = AuxStreamViews.FirstOrDefault(x => x.Handle == auxStream.Handle); if (personChangedEvent.ToPerson != null) { ShowAvartar(find.Handle, personChangedEvent.ToPerson.PersonId); ApplicationController.Instance.CurWebexManager.CurWebex.People.Get(personChangedEvent.ToPerson.PersonId, r => { if (r.IsSuccess) { find.PersonName = r.Data.DisplayName; } }); Output($"AuxStreamPersonChangedEvent: {find.Name} is changed to {personChangedEvent?.ToPerson?.Email}"); } else { Output($"AuxStreamPersonChangedEvent: {find.Name} is changed to null."); } } else if (auxStreamEvent is AuxStreamSizeChangedEvent auxViewSizeChanged) { var viewSize = auxViewSizeChanged.AuxStream.AuxStreamSize; var index = CurrentCall.AuxStreams.IndexOf(auxViewSizeChanged.AuxStream); Output($"AuxStreamSizeChangedEvent: aux[{index}] view size changes to width[{viewSize.Width}] height[{viewSize.Height}]"); } else if (auxStreamEvent is AuxStreamSendingVideoEvent auxStreamSending) { var index = CurrentCall.AuxStreams.IndexOf(auxStreamSending.AuxStream); Output($"AuxStreamSendingEvent: aux[{index}] IsSendingVideo[{auxStreamSending.AuxStream.IsSendingVideo}]"); var auxStream = auxStreamSending.AuxStream; Application.Current.Dispatcher.Invoke(() => { var find = AuxStreamViews.First(x => x.Handle == auxStream.Handle); find.IsSendingVideo = auxStream.IsSendingVideo; }); if (auxStream.IsSendingVideo) { UpdateAuxStreamView(auxStream); } else { //show avatar or spinning circle if (auxStream.Person != null) { ShowAvartar(auxStream.Handle, auxStream.Person.PersonId); } } } }