예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoteMedia"/> class.
 /// </summary>
 /// <param name="disableAudio">if set to <c>true</c> [disable audio].</param>
 /// <param name="disableVideo">if set to <c>true</c> [disable video].</param>
 /// <param name="aecContext">The aec context.</param>
 public RemoteMedia(bool disableAudio, bool disableVideo, AecContext aecContext)
     : base(disableAudio, disableVideo, aecContext)
 {
     Initialize();
 }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoteMedia"/> class.
 /// </summary>
 /// <param name="disableAudio">if set to <c>true</c> [disable audio].</param>
 /// <param name="disableVideo">if set to <c>true</c> [disable video].</param>
 /// <param name="aecContext">The aec context.</param>
 public RemoteMedia(Android.Content.Context context, bool disableAudio, bool disableVideo, AecContext aecContext)
     : base(disableAudio, disableVideo, aecContext)
 {
     this.context = context;
     Initialize();
 }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LocalCameraMedia"/> class.
 /// </summary>
 /// <param name="disableAudio">Whether to disable audio.</param>
 /// <param name="disableVideo">Whether to disable video.</param>
 /// <param name="aecContext">The AEC context, if using software echo cancellation.</param>
 public LocalCameraMedia(bool disableAudio, bool disableVideo, AecContext aecContext)
     : base(disableAudio, disableVideo, aecContext)
 {
     _preview = new AVCapturePreview();
     Initialize();
 }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LocalCameraMedia"/> class.
 /// </summary>
 /// <param name="context">The Android context.</param>
 /// <param name="disableAudio">Whether to disable audio.</param>
 /// <param name="disableVideo">Whether to disable video.</param>
 /// <param name="aecContext">The AEC context, if using software echo cancellation.</param>
 public LocalCameraMedia(Android.Content.Context context, bool disableAudio, bool disableVideo, AecContext aecContext)
     : base(context, disableAudio, disableVideo, aecContext)
 {
     _preview = new FM.IceLink.Android.CameraPreview(context, LayoutScale.Contain);
     Initialize();
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LocalMedia"/> class.
 /// </summary>
 /// <param name="context">The Android context.</param>
 /// <param name="disableAudio">Whether to disable audio.</param>
 /// <param name="disableVideo">Whether to disable video.</param>
 /// <param name="aecContext">The AEC context, if using software echo cancellation.</param>
 public LocalMedia(Android.Content.Context context, bool disableAudio, bool disableVideo, AecContext aecContext)
     : base(disableAudio, disableVideo, aecContext)
 {
     this.context = context;
 }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LocalMedia"/> class.
 /// </summary>
 /// <param name="disableAudio">Whether to disable audio.</param>
 /// <param name="disableVideo">Whether to disable video.</param>
 /// <param name="aecContext">The AEC context, if using software echo cancellation.</param>
 public LocalMedia(bool disableAudio, bool disableVideo, AecContext aecContext)
     : base(disableAudio, disableVideo, aecContext)
 {
     AVAudioSession.SharedInstance().SetCategory(AVAudioSessionCategory.PlayAndRecord, AVAudioSessionCategoryOptions.AllowBluetooth | AVAudioSessionCategoryOptions.DefaultToSpeaker);
 }
예제 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LocalScreenMedia"/> class.
 /// </summary>
 /// <param name="context">The Android context.</param>
 /// <param name="disableAudio">Whether to disable audio.</param>
 /// <param name="disableVideo">Whether to disable video.</param>
 /// <param name="aecContext">The AEC context, if using software echo cancellation.</param>
 public LocalScreenMedia(MediaProjection projection, Android.Content.Context context, bool disableAudio, bool disableVideo, AecContext aecContext)
     : base(context, disableAudio, disableVideo, aecContext)
 {
     projectionSource = new MediaProjectionSource(projection, context, 3);
     Initialize();
 }
예제 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LocalScreenMedia"/> class.
 /// </summary>
 /// <param name="disableAudio">Whether to disable audio.</param>
 /// <param name="disableVideo">Whether to disable video.</param>
 /// <param name="aecContext">The AEC context, if using software echo cancellation.</param>
 public LocalScreenMedia(bool disableAudio, bool disableVideo, AecContext aecContext)
     : base(disableAudio, disableVideo, aecContext)
 {
     Initialize();
 }
예제 #9
0
        public Future <FM.IceLink.LocalMedia> StartLocalMedia(Android.Content.Context context, AbsoluteLayout container)
#endif
        {
            return(_certificatePromise.Then <FM.IceLink.LocalMedia>((cert) =>
            {
                _certificate = cert;

                if (!EnableAudioSend && !EnableVideoSend)
                {
                    LayoutManager = new XamarinLayoutManager(container);

                    return Promise <FM.IceLink.LocalMedia> .ResolveNow <FM.IceLink.LocalMedia>(null);
                }
                else
                {
                    Xamarin.Forms.View localView;
                    // Set up the local media.
                    if (!EnableScreenShare)
                    {
#if __IOS__
                        LocalCameraMedia = new LocalCameraMedia(!EnableAudioSend, !EnableVideoSend, null);
#else
                        if (EnableAudioSend)
                        {
                            _AecContext = new AecContext();
                            LocalCameraMedia = new LocalCameraMedia(context, !EnableAudioSend, !EnableVideoSend, _AecContext);
                        }
                        else
                        {
                            LocalCameraMedia = new LocalCameraMedia(context, !EnableAudioSend, !EnableVideoSend, null);
                        }
#endif
                        localView = new FMView(((LocalCameraMedia)LocalCameraMedia).GetView());
                    }
                    else
                    {
#if __IOS__
                        LocalScreenMedia = new LocalScreenMedia(!EnableAudioSend, !EnableVideoSend, null);
#else
                        if (EnableAudioSend)
                        {
                            _AecContext = new AecContext();
                            LocalScreenMedia = new LocalScreenMedia(MediaProjection, context, !EnableAudioSend, !EnableVideoSend, _AecContext);
                        }
                        else
                        {
                            LocalScreenMedia = new LocalScreenMedia(MediaProjection, context, !EnableAudioSend, !EnableVideoSend, null);
                        }
#endif
                        localView = new FMView(LocalScreenMedia.View);
                    }

                    // Set up the layout manager.
                    LayoutManager = new XamarinLayoutManager(container);

                    // Add the local preview to the layout.
                    if (localView != null)
                    {
                        LayoutManager.SetLocalView(localView);

                        // TODO Context menu
                        //LocalMedia.View.ContextMenu = videoChat.LocalContextMenu;
                    }

                    // Start the local media.
                    if (!EnableScreenShare)
                    {
                        return LocalCameraMedia.Start();
                    }
                    else
                    {
                        return LocalScreenMedia.Start();
                    }
                }
            }));
        }