Esempio n. 1
0
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(AgoraVideoView.StreamUID) || e.PropertyName == nameof(AgoraVideoView.Mode))
            {
                global::Android.App.Application.SynchronizationContext.Post(_ =>
                {
                    try
                    {
                        if (_callView.IsStatic)
                        {
                            _layout = new FrameLayout(Context)
                            {
                                LayoutParameters = new FrameLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent)
                            };
                            _videoService = DependencyService.Get <IAgoraService>() as AgoraServiceImplementation;

                            SetNativeControl(_layout);
                            _videoService.SetupView(UpdatedHolder());
                        }
                    }
                    catch (Exception ex)
                    {
                        _holder.NativeView?.RemoveAllViews();
                    }
                }, null);
            }
            base.OnElementPropertyChanged(sender, e);
        }
Esempio n. 2
0
 /// <summary>
 /// On the element changed.
 /// </summary>
 /// <param name="e">E.</param>
 protected override void OnElementChanged(global::Xamarin.Forms.Platform.Android.ElementChangedEventArgs <global::Xamarin.Forms.View> e)
 {
     base.OnElementChanged(e);
     if (e.NewElement == null)
     {
         return;
     }
     global::Android.App.Application.SynchronizationContext.Post(_ =>
     {
         _callView = e.NewElement as AgoraVideoView;
         _layout   = new FrameLayout(Context)
         {
             LayoutParameters = new FrameLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent)
         };
         _videoService = DependencyService.Get <IAgoraService>() as AgoraServiceImplementation;
         SetNativeControl(_layout);
         _videoService.SetupView(UpdatedHolder());
     }, null);
 }