示例#1
0
        /// <summary>
        /// On the element changed.
        /// </summary>
        /// <param name="e">E.</param>
        protected override void OnElementChanged(global::Xamarin.Forms.Platform.MacOS.ElementChangedEventArgs <global::Xamarin.Forms.View> e)
        {
            base.OnElementChanged(e);
            if (e.NewElement == null)
            {
                return;
            }
            _callView = e.NewElement as AgoraVideoView;
            var width  = e.NewElement.Width;
            var height = e.NewElement.Height;

            _layout       = new NSView(new CoreGraphics.CGRect(0, 0, (nfloat)Element.Width, (nfloat)Element.Height)); //(new RectangleF(0, 0, width, height)) { Hidden = false };
            _videoService = DependencyService.Get <IAgoraService>() as AgoraServiceImplementation;
            SetNativeControl(_layout);
            _videoService.SetupView(UpdatedHolder());
        }
示例#2
0
 protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(AgoraVideoView.StreamUID) || e.PropertyName == nameof(AgoraVideoView.Mode))
     {
         try
         {
             if (_callView.IsStatic)
             {
                 _layout       = new NSView(new CoreGraphics.CGRect(0, 0, (nfloat)Element.Width, (nfloat)Element.Height)); //(new RectangleF(0, 0, width, height)) { Hidden = false };
                 _videoService = DependencyService.Get <IAgoraService>() as AgoraServiceImplementation;
                 SetNativeControl(_layout);
                 _videoService.SetupView(UpdatedHolder());
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex);
             _holder.NativeView?.RemoveFromSuperview();
         }
     }
     base.OnElementPropertyChanged(sender, e);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Xamarin.Agora.Full.Forms.AgoraRtcDelegate"/> class.
 /// </summary>
 /// <param name="controller">Controller.</param>
 public AgoraRtcDelegate(AgoraServiceImplementation controller) : base()
 {
     _controller = controller;
 }