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(); } }
/** * <p> * Implementation of the {@link Supplier} interface that returns a newly created * {@link Publisher}. * </p><p> * The {@link Publisher.Builder} is passed a {@link Consumer} in its constructor which * basically triggers a call to {@link Network#setPublisher(Publisher)} with the newly * created {@link Publisher} - which must be available so that users can get a reference * to the new Publisher that is created when {@link Network#load()} is called. * * @return a new Publisher */ public Publisher Get() { if (suppliedInstance == null) { Publisher.Builder <Subject <string> > builder = Publisher.GetBuilder(p => network?.SetPublisher(p)); headers.ForEach(line => builder.AddHeader(line)); suppliedInstance = builder.Build(); suppliedInstance.SetNetwork(network); } return(suppliedInstance); }
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 OnDidConnect(object sender, EventArgs e) { lock (_locker) { if (Session == null || PublisherKit != null) { return; } PublisherKit = new Publisher.Builder(CrossCurrentActivity.Current.AppContext).Build(); PublisherKit.StreamCreated += OnPublisherStreamCreated; PublisherKit.SetStyle(BaseVideoRenderer.StyleVideoScale, BaseVideoRenderer.StyleVideoFill); PublisherKit.PublishAudio = IsAudioPublishingEnabled; PublisherKit.PublishVideo = IsVideoPublishingEnabled; PublisherUpdated?.Invoke(); Session.Publish(PublisherKit); PublisherKit.PublishVideo = IsVideoPublishingEnabled; } }