예제 #1
0
        public void DidError(IARDAppClient client, NSError error)
        {
            var alertView = new UIAlertView("", error.ToString(), null, "OK", null);

            alertView.Show();
            Disconnect();
        }
예제 #2
0
        public void DidReceiveRemoteVideoTrack(IARDAppClient client, RTCVideoTrack remoteVideoTrack)
        {
            this.remoteVideoTrack = remoteVideoTrack;
            this.remoteVideoTrack.AddRenderer(remoteView);

            UIView.Animate(0.4f, () =>
            {
                //    //Instead of using 0.4 of screen size, we re-calculate the local view and keep our aspect ratio
                UIDeviceOrientation orientation = UIDevice.CurrentDevice.Orientation;
                var containerWidth  = View.Frame.Size.Width;
                var containerHeight = View.Frame.Size.Height;
                var videoRect       = new CGRect(0.0f, 0.0f, containerWidth / 4.0f, containerHeight / 4.0f);
                if (orientation == UIDeviceOrientation.LandscapeLeft || orientation == UIDeviceOrientation.LandscapeRight)
                {
                    videoRect = new CGRect(0.0f, 0.0f, containerHeight / 4.0f, containerWidth / 4.0f);
                }
                CGRect videoFrame = AVFoundation.AVUtilities.WithAspectRatio(videoRect, localView.Frame.Size);                 //AVMakeRectWithAspectRatioInsideRect(aspectRatio, videoRect);

                //    [self.localViewWidthConstraint setConstant:videoFrame.size.width];
                //    [self.localViewHeightConstraint setConstant:videoFrame.size.height];


                //    [self.localViewBottomConstraint setConstant:28.0f];
                //    [self.localViewRightConstraint setConstant:28.0f];
                //    [self.footerViewBottomConstraint setConstant:-80.0f];
                View.LayoutIfNeeded();
            });;
        }
예제 #3
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            NavigationController.SetNavigationBarHidden(true, true);

            // //Display the Local View full screen while connecting to Room
            // [self.localViewBottomConstraint setConstant:0.0f];
            // [self.localViewRightConstraint setConstant:0.0f];
            // [self.localViewHeightConstraint setConstant:self.view.frame.size.height];
            // [self.localViewWidthConstraint setConstant:self.view.frame.size.width];
            // [self.footerViewBottomConstraint setConstant:0.0f];

            // //Connect to the room
            Disconnect();
            client = new ARDAppClient(this);
            client.SetServerHostUrl(SERVER_HOST_URL);
            client.ConnectToRoomWithId(roomName);
            urlLabel.Text = roomUrl;
        }
예제 #4
0
        public void DidChangeState(IARDAppClient client, ARDAppClientState state)
        {
            switch (state)
            {
            case ARDAppClientState.Connected:
                Console.WriteLine("Client connected");
                break;

            case ARDAppClientState.Connecting:

                Console.WriteLine("Client connecting");
                break;

            case ARDAppClientState.Disconnected:
                RemoteDisconnected();
                Console.WriteLine("Client disconnected");
                break;

            default:
                break;
            }
        }
예제 #5
0
        public void DidReceiveRemoteVideoTrack(IARDAppClient client, RTCVideoTrack remoteVideoTrack)
        {
            this.remoteVideoTrack = remoteVideoTrack;
            this.remoteVideoTrack.AddRenderer(remoteView);

            //[UIView animateWithDuration:0.4f animations:^{
            //    //Instead of using 0.4 of screen size, we re-calculate the local view and keep our aspect ratio
            //    UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
            //    CGRect videoRect = CGRectMake(0.0f, 0.0f, self.view.frame.size.width/4.0f, self.view.frame.size.height/4.0f);
            //    if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight) {
            //        videoRect = CGRectMake(0.0f, 0.0f, self.view.frame.size.height/4.0f, self.view.frame.size.width/4.0f);
            //    }
            //    CGRect videoFrame = AVMakeRectWithAspectRatioInsideRect(_localView.frame.size, videoRect);

            //    [self.localViewWidthConstraint setConstant:videoFrame.size.width];
            //    [self.localViewHeightConstraint setConstant:videoFrame.size.height];


            //    [self.localViewBottomConstraint setConstant:28.0f];
            //    [self.localViewRightConstraint setConstant:28.0f];
            //    [self.footerViewBottomConstraint setConstant:-80.0f];
            //    [self.view layoutIfNeeded];
            //}];
        }
예제 #6
0
 public void DidReceiveLocalVideoTrack(IARDAppClient client, RTCVideoTrack localVideoTrack)
 {
     LocalClear();
     this.localVideoTrack = localVideoTrack;
     localVideoTrack.AddRenderer(localView);
 }