示例#1
0
        private void OnConnected(object sender, Session.ConnectedEventArgs e)
        {
            if (Session == null)
            {
                return;
            }

            ClearPublisher();

            using (var builder = new Publisher.Builder(CrossCurrentActivity.Current.AppContext)
                                 .Resolution(Publisher.CameraCaptureResolution.High)
                                 .VideoTrack(Permissions.HasFlag(OpenTokPermission.Camera))
                                 .AudioTrack(Permissions.HasFlag(OpenTokPermission.RecordAudio))
                                 .Name("XamarinOpenTok"))
            {
                PublisherKit = builder.Build();
                PublisherKit.PublishVideo = IsVideoPublishingEnabled;
                PublisherKit.PublishAudio = IsAudioPublishingEnabled;
                PublisherKit.SetStyle(BaseVideoRenderer.StyleVideoScale, BaseVideoRenderer.StyleVideoFill);
                PublisherKit.StreamCreated       += OnPublisherStreamCreated;
                PublisherKit.AudioFallbackEnabled = PublisherVideoType == OpenTokPublisherVideoType.Camera;
                PublisherKit.PublisherVideoType   = PublisherVideoType == OpenTokPublisherVideoType.Camera
                    ? PublisherKit.PublisherKitVideoType.PublisherKitVideoTypeCamera
                    : PublisherKit.PublisherKitVideoType.PublisherKitVideoTypeScreen;
                Session.Publish(PublisherKit);
                RaisePublisherUpdated();
            }
        }
示例#2
0
        private void OnConnected(object sender, Session.ConnectedEventArgs e)
        {
            if (Session == null || PublisherKit != null)
            {
                return;
            }

            using (var builder = new Publisher.Builder(CrossCurrentActivity.Current.AppContext).Name("XamarinOpenTok"))
            {
                PublisherKit = builder.Build();
                PublisherKit.PublishVideo = IsVideoPublishingEnabled;
                PublisherKit.PublishAudio = IsAudioPublishingEnabled;
                PublisherKit.SetStyle(BaseVideoRenderer.StyleVideoScale, BaseVideoRenderer.StyleVideoFill);
                PublisherKit.StreamCreated += OnPublisherStreamCreated;

                Session.Publish(PublisherKit);
                RaisePublisherUpdated();
            }
        }
 private void SetVideoScaleStyle(PublisherKit publisherKit)
 => publisherKit.SetStyle(BaseVideoRenderer.StyleVideoScale, MapVideoScaleStyle(PublisherVideoScaleStyle));