Example #1
0
        public async Task <IActionResult> Recording(ulong id, string type, string deviceName, int createdAt)
        {
            RingClient ring;

            try
            {
                var authToken = User.Claims.FirstOrDefault(e => e.Type == "auth_token")?.Value;
                ring = await RingClient.CreateAsync(authToken);
            }
            catch
            {
                return(Challenge());
            }

            try
            {
                RecordingViewModel model = new RecordingViewModel();

                var ding = new Ring.Models.Ding()
                {
                    Id = id, RecordingIsReady = true
                };
                model.RecordingUri = await ring.GetRecordingUriAsync(ding);

                model.Type       = type;
                model.DeviceName = deviceName;
                model.CreatedAt  = new DateTime(1970, 1, 1, 0, 0, 0).AddSeconds(createdAt);

                return(View(model));
            }
            catch
            {
                return(NotFound());
            }
        }
 public HotkeyActionRegisterer(ScreenShotViewModel ScreenShotViewModel,
                               HotKeyManager HotKeyManager,
                               RecordingViewModel RecordingViewModel,
                               Settings Settings)
 {
     _screenShotViewModel = ScreenShotViewModel;
     _hotKeyManager       = HotKeyManager;
     _recordingViewModel  = RecordingViewModel;
     _settings            = Settings;
 }
Example #3
0
 public HotKeyActionRegisterer(ScreenShotViewModel screenShotViewModel,
                               HotKeyManager hotKeyManager,
                               RecordingViewModel recordingViewModel,
                               Settings settings)
 {
     _screenShotViewModel = screenShotViewModel;
     _hotKeyManager       = hotKeyManager;
     _recordingViewModel  = recordingViewModel;
     _settings            = settings;
 }
Example #4
0
 public MainWindowHelper(MainViewModel MainViewModel,
                         HotkeySetup HotkeySetup,
                         TimerModel TimerModel,
                         Settings Settings,
                         RecordingViewModel RecordingViewModel)
 {
     this.MainViewModel      = MainViewModel;
     this.HotkeySetup        = HotkeySetup;
     this.TimerModel         = TimerModel;
     this.Settings           = Settings;
     this.RecordingViewModel = RecordingViewModel;
 }
        //private readonly ServiceLocator serviceLocator;

        public RecordStreamViewModel(Settings Settings, ILocalizationProvider Loc,
                                     VideoSourcesViewModel VideoSourcesViewModel,
                                     VideoWritersViewModel VideoWritersViewModel,
                                     AudioSourceViewModel AudioSourceViewModel,
                                     RecordingViewModel RecordingViewModel) : base(Settings, Loc)
        {
            //Init();

            //serviceLocator = new ServiceLocator();
            //RecordCommand = serviceLocator.RecordingViewModel.RecordCommand;
            //PauseCommand = serviceLocator.RecordingViewModel.PauseCommand;

            //serviceLocator.VideoSourcesViewModel.SelectedVideoSourceKind =
            //    serviceLocator.VideoSourcesViewModel.VideoSources.FirstOrDefault(M => M is FullScreenSourceProvider);

            //serviceLocator.VideoWritersViewModel.SelectedVideoWriterKind =
            //    serviceLocator.VideoWritersViewModel.VideoWriterProviders.FirstOrDefault(M =>
            //        M is FFmpegWriterProvider);

            //serviceLocator.VideoWritersViewModel.SelectedVideoWriter =
            //    serviceLocator.VideoWritersViewModel.AvailableVideoWriters.FirstOrDefault(M => M is X264VideoCodec);

            //foreach (var availableSpeaker in serviceLocator.AudioSourceViewModel.AvailableSpeakers)
            //{
            //    Console.WriteLine("Speaker name: " + availableSpeaker.Name);
            //}

            //Console.WriteLine("Speaker : " + serviceLocator.AudioSourceViewModel.AvailableSpeakers[1].Name);
            //serviceLocator.RecordingViewModel.Settings.Audio.RecordSpeaker = true;
            //serviceLocator.AudioSourceViewModel.SelectedSpeaker =
            //    serviceLocator.AudioSourceViewModel.AvailableSpeakers[1];


            videoSourceViewModel   = VideoSourcesViewModel;
            videoWriterViewmoModel = VideoWritersViewModel;
            audioSourceViewModel   = AudioSourceViewModel;
            recordingViewModel     = RecordingViewModel;

            RecordCommand = RecordingViewModel.RecordCommand;
            PauseCommand  = RecordingViewModel.PauseCommand;

            ConfigDefault();
        }
 public MainPage()
 {
     this.InitializeComponent();
     this.ViewModel = new RecordingViewModel();
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Initialize Recorder
            RVM = new RecordingViewModel();

            // Perform any additional setup after loading the view, typically from a nib.
            // Init audio session
            AudioSession.Initialize(null, NSRunLoop.NSDefaultRunLoopMode);
            AudioSession.AudioRouteChanged += AudioSession_AudioRouteChanged;

            // Init call event handler
            callcenter.CallEventHandler += callState.CallEvent;

            // Set menu button
            UIImageView menuImageView = new UIImageView();

            menuImageView.Bounds = new CGRect(0, 0, 20, 20);
            menuImageView.Image  = UIImage.FromBundle("threelines");

            menuButton = new UIBarButtonItem(
                menuImageView.Image,
                UIBarButtonItemStyle.Plain,
                (s, e) => {
                System.Diagnostics.Debug.WriteLine("menu button tapped");
                if (RVM.IsRecording)
                {
                    SidebarController.ToggleMenu();
                    var okAlertController = UIAlertController.Create("", UiStrings.MainNotificationSuspendUserAction, UIAlertControllerStyle.Alert);
                    //Add Action
                    okAlertController.AddAction(UIAlertAction.Create(NSBundle.MainBundle.GetLocalizedString("Vernacular_P0_dialog_ok"), UIAlertActionStyle.Default, alert => {
                        RVM.StopRecordingCommand.Execute(null);
                    }));

                    PresentViewController(okAlertController, true, null);
                }
                else
                {
                    SidebarController.ToggleMenu();
                }
            }
                );

            // Add button to item array
            barButtonItems [0] = menuButton;
            NavigationItem.LeftBarButtonItem = menuButton;

            // Set bottom view labels
            lblTitle.Text = "";
            lblBody.Text  = "";

            // Set start button style
            btnStart.SetBackgroundImage(UIImage.FromBundle("CarButton"), UIControlState.Normal);
            View.BackgroundColor = StyleSettings.ThemePrimaryDarkLightenedColor();
            btnStart.SetTitle("", UIControlState.Normal);

            // Add square to stop || TODO: change to image
            UIView stopSquare = new UIView(new RectangleF(
                                               (float)(btnStop.Bounds.X + 15),
                                               (float)(btnStop.Bounds.Y + 15),
                                               (float)(btnStop.Bounds.Width - 30),
                                               (float)(btnStop.Bounds.Height - 30))
                                           );

            // Set stop button attributes
            stopButtonTranslation      = btnStopBottomConstraint.Constant;
            stopSquare.BackgroundColor = UIColor.White;
            btnStop.SetBackgroundImage(UIImage.FromBundle("srs-stop-btn"), UIControlState.Normal);
            btnStop.Layer.CornerRadius = btnStop.Bounds.Width / 2;

            lblLeft.Hidden   = true;
            lblCenter.Hidden = true;
            lblRight.Hidden  = true;

            // Set initial status of vehicle type & support
            btnSupport.Hidden        = true;
            btnVehicle.Hidden        = true;
            lblCalibration.Hidden    = true;
            lblCalibration.Text      = NSBundle.MainBundle.LocalizedString("Vernacular_P0_label_setup", null);
            lblCalibration.TextColor = StyleSettings.SubduedTextOnDarkColor();

            // Logic
            btnStart.TouchUpInside += (object sender, EventArgs e) => {
                if (Settings.CalibrationDone)
                {
                    if (RVM.IsRecording)
                    {
                        return;
                    }

                    var passengerNumberPickerVC = Storyboard.InstantiateViewController("PassengerNumberPickerViewController") as PassengerNumberPickerViewController;
                    passengerNumberPickerVC.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
                    passengerNumberPickerVC.ModalTransitionStyle   = UIModalTransitionStyle.CoverVertical;
                    passengerNumberPickerVC.parentVC = this;
                    NavigationController.PresentViewController(passengerNumberPickerVC, true, null);
                }
                else
                {
                    // TODO: warn user that calibration has to be done
                }
            };

            btnStop.TouchUpInside += (object sender, EventArgs e) => {
                UnbindFromService();
                AnimateStopButton();
                RVM.OnDestroy();
                StopRecording();
                UpdateRecordButtonUi();
                UploadData();
                lblCenter.Hidden = true;
            };

            btnVehicle.TouchUpInside += (object sender, EventArgs e) => {
                OpenSettingsVC();
            };

            btnSupport.TouchUpInside += (object sender, EventArgs e) => {
                OpenSettingsVC();
            };
        }
Example #8
0
        private void Pause_Click(object sender, RoutedEventArgs e)
        {
            RecordingViewModel rvm = ServiceProvider.Get <RecordingViewModel>();

            rvm.OnRecordPause();
        }