示例#1
0
        public async Task JoinGroup(Guid groupID)
        {
            Logger.Debug("Setting up local video");
            var camera = _deviceManager
                         .Cameras.First(c => c.CameraFacing == ACSCameraFacing.Front);

            _localVideoStream         = new ACSLocalVideoStream(camera);
            _localVideoStreamRenderer = new ACSVideoStreamRenderer(_localVideoStream, out var rendererError);
            ThrowIfError(rendererError);
            var renderingOptions = new ACSCreateViewOptions(ACSScalingMode.Crop);
            var nativeView       = _localVideoStreamRenderer.CreateViewWithOptions(renderingOptions, out var viewError);

            ThrowIfError(viewError);
            var formsView = nativeView.ToView();

            LocalVideoAdded?.Invoke(this, formsView);

            var groupCallLocator = new ACSGroupCallLocator(new NSUuid(groupID.ToString()));
            var callOptions      = new ACSJoinCallOptions
            {
                AudioOptions = new ACSAudioOptions(),
                VideoOptions = new ACSVideoOptions(new [] { _localVideoStream })
            };

            Logger.Debug("Joining group");
            //callOptions.AudioOptions.Muted = true;
            _callAgent.JoinWithMeetingLocator(groupCallLocator, callOptions, callCompleted);
        }
示例#2
0
        private void RemoteVideoStreamAdded(ACSRemoteVideoStream remoteVideoStream)
        {
            Logger.Debug("RemoteVideoStreamAdded");
            if (!remoteVideoStream.IsAvailable)
            {
                return;
            }

            _remoteVideoStreams.RemoveAll(s => s.Id == remoteVideoStream.Id);

            _remoteVideoStreams.Add(remoteVideoStream);
            Logger.Debug("RemoteVideoStreamAdded: Creating renderer");
            Device.BeginInvokeOnMainThread(() =>
            {
                var renderer = new ACSVideoStreamRenderer(remoteVideoStream, out var rendererError);
                ThrowIfError(rendererError);
                var renderingOptions = new ACSCreateViewOptions(ACSScalingMode.Crop);
                var nativeView       = renderer.CreateViewWithOptions(renderingOptions, out var createViewError);
                Logger.Debug("RemoteVideoStreamAdded: Created renderer");
                ThrowIfError(createViewError);
                var formsView = nativeView.ToView();
                RemoteVideoAdded?.Invoke(this, formsView);
            });
        }