void RemoteDisconnected() { remoteVideoTrack?.RemoveRenderer(remoteView); remoteVideoTrack = null; remoteView.RenderFrame(null); this.DidChangeVideoSize(localView, localVideoSize); }
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(); });; }
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); }
void RemoteDisconnected() { remoteVideoTrack?.RemoveRenderer(remoteView); remoteVideoTrack = null; remoteView.RenderFrame(null); //[self videoView:self.localView didChangeVideoSize:self.localVideoSize]; }
internal void Disconnect() { if (client != null) { localVideoTrack?.RemoveRenderer(localView); remoteVideoTrack?.RemoveRenderer(remoteView); localVideoTrack = null; localView.RenderFrame(null); RemoteDisconnected(); client.Disconnect(); } }
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); }
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); } }
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); }
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]; //}]; }
public void DidReceiveLocalVideoTrack(IARDAppClient client, RTCVideoTrack localVideoTrack) { LocalClear(); this.localVideoTrack = localVideoTrack; localVideoTrack.AddRenderer(localView); }
void LocalClear() { localVideoTrack?.RemoveRenderer(localView); localVideoTrack = null; localView.RenderFrame(null); }
public VideoTrackNative(RTCVideoTrack videoTrack) : base(videoTrack) { _videoTrack = videoTrack; }
public PlatformVideoTrack(RTCVideoTrack videoTrack) => _videoTrack = videoTrack;
public void DidReceiveRemoteVideoTrack(RTCVideoTrack remoteVideoTrack) { SetRemoteVideoTrack(remoteVideoTrack); }
public void DidReceiveLocalVideoTrack(RTCVideoTrack localVideoTrack) { }