예제 #1
0
 void RemoteDisconnected()
 {
     remoteVideoTrack?.RemoveRenderer(remoteView);
     remoteVideoTrack = null;
     remoteView.RenderFrame(null);
     this.DidChangeVideoSize(localView, localVideoSize);
 }
예제 #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
        RTCVideoTrack CreateLocalVideoTrack()
        {
            // The iOS simulator doesn't provide any sort of camera capture
            // support or emulation (http://goo.gl/rHAnC1) so don't bother
            // trying to open a local stream.
            // TODO(tkchin): local video capture for OSX. See
            // https://code.google.com/p/webrtc/issues/detail?id=3417.

            RTCVideoTrack localVideoTrack = null;

#if !TARGET_IPHONE_SIMULATOR && TARGET_OS_IPHONE
            //NSString *cameraID = nil;
            //for (AVCaptureDevice *captureDevice in
            //     [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]) {
            //    if (captureDevice.position == AVCaptureDevicePositionFront) {
            //        cameraID = [captureDevice localizedName];
            //        break;
            //    }
            //}
            //NSAssert(cameraID, @"Unable to get the front camera id");

            //RTCVideoCapturer *capturer = [RTCVideoCapturer capturerWithDeviceName:cameraID];
            //RTCMediaConstraints *mediaConstraints = [self defaultMediaStreamConstraints];
            //RTCVideoSource *videoSource = [_factory videoSourceWithCapturer:capturer constraints:mediaConstraints];
            //localVideoTrack = [_factory videoTrackWithID:@"ARDAMSv0" source:videoSource];
#endif
            return(localVideoTrack);
        }
예제 #4
0
        void RemoteDisconnected()
        {
            remoteVideoTrack?.RemoveRenderer(remoteView);
            remoteVideoTrack = null;
            remoteView.RenderFrame(null);

            //[self videoView:self.localView didChangeVideoSize:self.localVideoSize];
        }
예제 #5
0
 internal void Disconnect()
 {
     if (client != null)
     {
         localVideoTrack?.RemoveRenderer(localView);
         remoteVideoTrack?.RemoveRenderer(remoteView);
         localVideoTrack = null;
         localView.RenderFrame(null);
         RemoteDisconnected();
         client.Disconnect();
     }
 }
예제 #6
0
        private void SetRemoteVideoTrack(RTCVideoTrack remoteVideoTrack)
        {
            if (_remoteVideoTrack == remoteVideoTrack)
            {
                return;
            }

            _remoteVideoTrack?.RemoveRenderer(_videoCallView.RemoteVideoRender);
            _remoteVideoTrack = null;
            _videoCallView.RemoteVideoRender.RenderFrame(null);
            _remoteVideoTrack = remoteVideoTrack;
            _remoteVideoTrack.AddRenderer(_videoCallView.RemoteVideoRender);
        }
예제 #7
0
        public void DidReceiveLocalVideoTrack(RTCVideoTrack localVideoTrack)
        {
            _localVideoTrack = localVideoTrack;
            if (ObjCRuntime.Runtime.Arch == ObjCRuntime.Arch.SIMULATOR)
            {
                var localView = new RTCEAGLVideoView();
                View.AddSubview(localView);

                var bounds          = View.Bounds;
                var localVideoFrame = new CGRect(0, 0, 100f, 100f);
                // Place the view in the bottom right.
                localVideoFrame.Location = new CGPoint(
                    bounds.GetMaxX() - localVideoFrame.Size.Width - 8, bounds.GetMaxY() - localVideoFrame.Size.Height - 8 - AppDelegate.SafeAreaInsets.Top);

                localView.Frame = localVideoFrame;


                _localVideoTrack.AddRenderer(localView);
            }
        }
예제 #8
0
        RTCMediaStream CreateLocalMediaStream()
        {
            RTCMediaStream localStream = _factory.MediaStreamWithLabel("ARDAMS");

            RTCVideoTrack localVideoTrack = CreateLocalVideoTrack();

            if (localVideoTrack != null)
            {
                localStream.AddVideoTrack(localVideoTrack);
                ARDAppClientDelegate.DidReceiveLocalVideoTrack(this, localVideoTrack);
                //        [_delegate appClient:self didReceiveLocalVideoTrack:localVideoTrack];
            }

            localStream.AddAudioTrack(_factory.AudioTrackWithID("ARDAMSa0"));
            if (_isSpeakerEnabled)
            {
                EnableSpeaker();
            }

            return(localStream);
        }
예제 #9
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];
            //}];
        }
예제 #10
0
 public void DidReceiveLocalVideoTrack(IARDAppClient client, RTCVideoTrack localVideoTrack)
 {
     LocalClear();
     this.localVideoTrack = localVideoTrack;
     localVideoTrack.AddRenderer(localView);
 }
예제 #11
0
 void LocalClear()
 {
     localVideoTrack?.RemoveRenderer(localView);
     localVideoTrack = null;
     localView.RenderFrame(null);
 }
예제 #12
0
 public VideoTrackNative(RTCVideoTrack videoTrack) : base(videoTrack)
 {
     _videoTrack = videoTrack;
 }
예제 #13
0
 public PlatformVideoTrack(RTCVideoTrack videoTrack) => _videoTrack = videoTrack;
예제 #14
0
 public void DidReceiveRemoteVideoTrack(RTCVideoTrack remoteVideoTrack)
 {
     SetRemoteVideoTrack(remoteVideoTrack);
 }
 public void DidReceiveLocalVideoTrack(RTCVideoTrack localVideoTrack)
 {
 }