Beispiel #1
0
    void Start()
    {
        button = GetComponent <Button>();
        button.onClick.AddListener(delegate { OnRecordButtonClick(); });

        photoBtn     = transform.parent.Find("Photo").GetComponent <Selectable>();
        switchCamBtn = transform.parent.Find("ChangeCam").GetComponent <Selectable>();

        animator           = transform.parent.GetComponentInParent <Animator>();
        isRecordingParamId = Animator.StringToHash("IsRecording");

        clickSound    = GetComponent <AudioSource>();
        videoRecorder = FindObjectOfType <VideoRecorder>();
        videoRecorder.PreRecordStarted += OnRecordStart;
        videoRecorder.PostRecordStoped += OnRecordStop;

        messager = transform.parent.parent.Find("Messager").GetComponent <MessagerBehaviour>();
    }
Beispiel #2
0
 private void Awake()
 {
     cube          = Instantiate(Cube);
     videoRecorder = FindObjectOfType <VideoRecorder>();
     videoRecorder.FilePathType  = VideoRecorder.OutputPathType.PersistentDataPath;
     videoRecorder.StatusUpdate += (status, msg) =>
     {
         if (status == RecordStatus.OnStarted)
         {
             GUIPopup.EnqueueMessage("Recording start", 5);
         }
         if (status == RecordStatus.FailedToStart || status == RecordStatus.FileFailed || status == RecordStatus.LogError)
         {
             GUIPopup.EnqueueMessage("Recording Error: " + status + ", details: " + msg, 5);
         }
         Debug.Log("RecordStatus: " + status + ", details: " + msg);
     };
 }
Beispiel #3
0
    protected virtual void Start()
    {
        // The event processor is used to execute action on the main thread
        eventProcessor = GetComponent <EventProcessor>();
        if (eventProcessor == null)
        {
            eventProcessor = gameObject.AddComponent <EventProcessor>();
        }

        // Init parser and corresponding events
        parser = new CommandParser();
        parser.playReceived         += delegate() { eventProcessor.QueueEvent(new Action(Play)); };
        parser.pauseReceived        += delegate() { eventProcessor.QueueEvent(new Action(Pause)); };
        parser.resetReceived        += delegate() { eventProcessor.QueueEvent(new Action(Reset)); };
        parser.loadScenarioReceived += delegate() { eventProcessor.QueueEvent(new Action(LoadScenario)); };
        parser.loadSafezoneReceived += delegate() { eventProcessor.QueueEvent(new Action(LoadPatientSafezone)); };

        parameters = FindObjectOfType <SessionParameters>();

        if (parameters != null)
        {
            session = parameters.Session;

            // Init the note processor
            noteProcessor        = new NoteProcessor(Application.persistentDataPath, session);
            parser.noteReceived += noteProcessor.Process;

            // Init the video recorder
            videoRecorder         = GetComponent <VideoRecorder>();
            videoRecorder.session = session;
            videoRecorder.StartRecord();
        }



        // Transmit every command received directly to the parser
        CommunicationManager.Instance.commandReceived += parser.Parse;
        CommunicationManager.Instance.Start();

        if (StartPaused)
        {
            Pause();
        }
    }
Beispiel #4
0
        public void Start()
        {
            string testTitle;

            if (NUnit.Framework.TestContext.CurrentContext.Test.Properties.ContainsKey("Description"))
            {
                testTitle = (NUnit.Framework.TestContext.CurrentContext.Test.Properties.Get("Description")).ToString();
            }
            else
            {
                testTitle = NUnit.Framework.TestContext.CurrentContext.Test.Name;
            }
            //Reporter.Instance.CreateTest()
            Context        = new Context(Id);
            PageValidation = new PageValidationController();
            _recording     = RecorderFactory.Instance.Create(testTitle);
            _recording.Start();
            PageValidation.Initialize(Context);
        }
    public static void Main()
    {
        var whiteBoard    = new WhiteBoard();
        var student       = new Student();
        var videoRecorder = new VideoRecorder();

        whiteBoard.Attach(student);
        //only student will be updated with this.
        whiteBoard.Update("Class started");

        //attach the video recorder.
        whiteBoard.Attach(videoRecorder);

        //both student and video recorder will receive this update/
        whiteBoard.Update("Date is 2013 ect..");
        whiteBoard.Detach(student);

        //only video recorder will receive this update.
        whiteBoard.Update("Class ended.");
    }
Beispiel #6
0
    public static void Main()
    {
        var whiteBoard = new WhiteBoard();
        var student = new Student();
        var videoRecorder = new VideoRecorder();

        whiteBoard.Attach(student);
        //only student will be updated with this.
        whiteBoard.Update("Class started");

        //attach the video recorder.
        whiteBoard.Attach(videoRecorder);

        //both student and video recorder will receive this update/
        whiteBoard.Update("Date is 2013 ect..");
        whiteBoard.Detach(student);

        //only video recorder will receive this update.
        whiteBoard.Update("Class ended.");
    }
Beispiel #7
0
        public void VideoTest()
        {
            Logger.Default = new NUnitProgressLogger();
            Logger.Default.SetLevel(LogLevel.Debug);
            SystemInfo.RefreshAll();
            var recorder = new VideoRecorder(new VideoRecorderSettings {
                VideoQuality = 26, ffmpegPath = @"C:\Users\rbl\Documents\ffmpeg.exe", TargetVideoPath = @"C:\temp\out.mp4"
            }, r =>
            {
                var img = Capture.Screen(1);
                img.ApplyOverlays(new InfoOverlay(img.DesktopBounds)
                {
                    RecordTimeSpan = r.RecordTimeSpan, OverlayStringFormat = @"{rt:hh\:mm\:ss\.fff} / {name} / CPU: {cpu} / RAM: {mem.p.used}/{mem.p.tot} ({mem.p.used.perc})"
                }, new MouseOverlay(img.DesktopBounds));
                return(img);
            });

            System.Threading.Thread.Sleep(5000);
            recorder.Dispose();
        }
Beispiel #8
0
        private async Task StopRecordingAsync()
        {
            try
            {
                _isRecording = false;
                await _mediaCapture.StopRecordAsync();

                UpdateInCommentSection(videoFile.Name);
                com1.Add(new comments {
                    empname = pd.emp.name, message = videoFile.Name, dt = DateTime.Now, empid = pd.emp.id, IsFile = true, storagefile = videoFile
                });
                commentsSection.ItemsSource = null;
                commentsSection.ItemsSource = com1;
                VideoRecorder.Hide();
            }
            catch (Exception ex)
            {
                MessageDialog md = new MessageDialog("Something went wrong...\nCan't stop video recording", "OOPS!");
                await md.ShowAsync();
            }
        }
        void QueryDevice(DriveItem drive)
        {
            VRDevice device = drive.Device;

            if (drive.IsInitialized)
            {
                drive.IsBlank     = device.MediaIsBlank;
                drive.IsVideo     = false;
                drive.VolumeLabel = String.Empty;

                if (device.Type == VRDeviceType.OpticalDisc)
                {
                    OpticalDiscDeviceConfig config = (OpticalDiscDeviceConfig)device.Config;
                    if (config.VolumeLabel != null)
                    {
                        drive.VolumeLabel = config.VolumeLabel;
                    }
                    else
                    {
                        drive.VolumeLabel = String.Empty;
                    }
                }

                VideoRecorder recorder = new VideoRecorder();
                Debug.Assert(recorder != null);

                recorder.Devices.Add(device);
                IList <Title> titles = recorder.GetTitles(0);
                if (titles != null)
                {
                    if (titles.Count > 0)
                    {
                        drive.IsVideo = true;
                    }
                }

                recorder.Dispose();
            }
        }
Beispiel #10
0
        public async Task BaseSetup()
        {
            // Start the recorder
            SystemInfo.RefreshAll();
            var ffmpegPath = await VideoRecorder.DownloadFFMpeg(@"C:\temp");

            _recorder = new VideoRecorder(new VideoRecorderSettings {
                VideoQuality = 26, ffmpegPath = ffmpegPath, TargetVideoPath = $@"C:\temp\{TestContext.CurrentContext.Test.ClassName}.mp4"
            }, r =>
            {
                var testName = TestContext.CurrentContext.Test.ClassName + "." + (_testMethodName ?? "[Setup]");
                var img      = Capture.Screen();
                img.ApplyOverlays(new InfoOverlay(img.DesktopBounds)
                {
                    RecordTimeSpan = r.RecordTimeSpan, OverlayStringFormat = @"{rt:hh\:mm\:ss\.fff} / {name} / CPU: {cpu} / RAM: {mem.p.used}/{mem.p.tot} ({mem.p.used.perc}) / " + testName
                }, new MouseOverlay(img.DesktopBounds));
                return(img);
            });
            await Task.Delay(500);

            StartTestApplication();
        }
Beispiel #11
0
        /// <summary>
        /// Executes the (manual) tests
        /// </summary>
        /// <param name="args">Ignore it :)</param>
        static void Main(string[] args)
        {
            Console.WindowWidth = 150;

            var dslr     = new Dslr(Company.Nicon, "D5600", 1000, CameraMode.Automatic, true);
            var compact  = new CompactCamera(Company.Canon, "Powershot G3 X", 755, CameraMode.Night, true, 4.0, 24);
            var videoCam = new VideoRecorder(Company.Sony, "HDRCX405", 200, CameraMode.Action, false, 1.6, 50);

            dslr.TakePhoto();

            System.Threading.Thread.Sleep(1500);

            compact.TakePhoto();
            System.Threading.Thread.Sleep(500);

            compact.StartVideo();
            System.Threading.Thread.Sleep(200);
            compact.StopVideo();

            videoCam.StartVideo();
            System.Threading.Thread.Sleep(1300);
            videoCam.StopVideo();

            System.Threading.Thread.Sleep(1500);

            var lens  = new Lens(Company.Zeiss, "LOXIA", 250, 2.4, 85);
            var flash = new Flash(Company.Sony, "GENERIC", 50, FlashType.Standalone, BrightnessLevel.UltraHigh, Company.Nicon, 85, true);

            dslr.Attach(lens);
            dslr.Attach(flash);
            dslr.FlashEnabled = true;

            dslr.TakePhoto();

            Console.WriteLine("\nTests finished!");
            Console.ReadLine();
        }
Beispiel #12
0
        public AndroidVideoRecorder(Context context, VideoRecorder CrossPlatformRecorder, CameraOptions cameraOption, OrientationOptions orientationOption)
            : base(context)
        {
            //Store references of recorder and options for later use
            XamRecorder       = CrossPlatformRecorder;
            CameraOption      = cameraOption;
            OrientationOption = orientationOption;

            if (IsCameraAvailable)
            {
                //Create the surface for drawing on
                surfaceView = new SurfaceView(context);
                AddView(surfaceView);
                holder = surfaceView.Holder;
                holder.AddCallback(this);

                windowManager = Context.GetSystemService(Context.WindowService).JavaCast <IWindowManager>();

                InitCamera();

                XamRecorder.IsPreviewing = false;
                XamRecorder.IsRecording  = false;
            }
        }
Beispiel #13
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            UnityEngine.SceneManagement.SceneManager.LoadScene(0);

            return;
        }

        if (adapter == null)
        {
            return;
        }

        if (adapter.SensorType != sensorType)
        {
            adapter.SensorType = sensorType;
        }

        Frame frame = VideoPlayer.IsPlaying ? VideoPlayer.Load() : adapter.UpdateFrame();

        if (VideoPlayer.IsPlaying && !VideoPlayer.IsSeeking)
        {
            seekSlider.slider.value = (VideoPlayer.Seek + 1) / (float)VideoPlayer.FrameCount;
        }

        if (frame != null)
        {
            if (frame.ImageData != null)
            {
                imageViewTexture = ValidateTexture(imageViewTexture, frame.ImageWidth, frame.ImageHeight, imageViewMaterial, imageViewTransform);

                if (imageViewTexture != null)
                {
                    if (isAndroid && VideoPlayer.IsPlaying)
                    {
                        imageViewTexture.LoadImage(frame.ImageData);
                    }
                    else
                    {
                        imageViewTexture.LoadRawTextureData(frame.ImageData);
                        imageViewTexture.Apply(false);
                    }
                }
            }

            depthFilter.UpdateFilter(frame);
            if (depthFilter.Result != null)
            {
                depthViewTexture = ValidateTexture(depthViewTexture, frame.DepthWidth, frame.DepthHeight, depthViewMaterial, depthViewTransform);

                if (depthViewTexture != null)
                {
                    depthViewTexture.LoadRawTextureData(depthFilter.Result);
                    depthViewTexture.Apply(false);
                }
            }

            Body body = frame.GetClosestBody();

            if (body != null)
            {
                imageViewStickman.UpdateStickman(adapter, frame, body, imageViewTransform, Visualization.Image);
                depthViewStickman.UpdateStickman(adapter, frame, body, depthViewTransform, Visualization.Depth);
                screenViewStickface.UpdateStickface(adapter, frame, body.Face, imageViewTransform, Visualization.Image);
                pointCloudStickface.UpdateStickface(body.Face);

                model.DoAvateering(body);
            }

            if (!VideoPlayer.IsPlaying)
            {
                VideoRecorder.Record(frame, recordingSettings);
            }
        }

        if (VideoRecorder.IsRecording)
        {
            bufferFrameCount = VideoRecorder.FrameCount;
        }

        if (bufferFrameCount > 0)
        {
            bufferVisuals.fillAmount = VideoRecorder.QueueLength / (float)bufferFrameCount;
            bufferQueueText.text     = VideoRecorder.QueueLength.ToString();
        }
    }
Beispiel #14
0
 /// <summary>
 /// Initializes all ScriptCore classes that data to the App Domain
 /// and initialize any other static members in Sims3.SimIFace classes.
 /// </summary>
 public static void Initialize()
 {
     if (!sInitialized)
     {
         if (gAnimation == null)
         {
             gAnimation = new Animation();
         }
         if (gAudio == null)
         {
             gAudio = new Audio();
         }
         if (gAutomationUtils == null)
         {
             gAutomationUtils = new AutomationUtils();
         }
         if (gCacheManager == null)
         {
             gCacheManager = new CacheManager();
         }
         if (gCameraController == null)
         {
             gCameraController = new CameraController();
         }
         if (gCASUtils == null)
         {
             gCASUtils = new CASUtils();
         }
         if (gCommandSystem == null)
         {
             gCommandSystem = new CommandSystem();
         }
         if (gCTProductModularObject == null)
         {
             gCTProductModularObject = new CTProductModularObject();
         }
         if (gDataFactory == null)
         {
             gDataFactory = new DataFactory();
         }
         if (gDebugDraw == null)
         {
             gDebugDraw = new DebugDraw();
         }
         if (gDeviceConfig == null)
         {
             gDeviceConfig = new DeviceConfig();
         }
         if (gDownloadContent == null)
         {
             gDownloadContent = new DownloadContent();
         }
         if (gEAText == null)
         {
             gEAText = new EAText();
         }
         if (gEATrace == null)
         {
             gEATrace = new EATrace();
         }
         if (gEventQueueInitializer == null)
         {
             gEventQueueInitializer = new EventQueueInitializer();
         }
         if (gGameUtils == null)
         {
             gGameUtils = new GameUtils();
         }
         if (gLoadSaveManager == null)
         {
             gLoadSaveManager = new LoadSaveManager();
         }
         if (gLocalizedStringService == null)
         {
             gLocalizedStringService = new LocalizedStringService();
         }
         if (gLookAtMgr == null)
         {
             gLookAtMgr = new LookAtMgr();
         }
         if (gNameGuidMapService == null)
         {
             gNameGuidMapService = new NameGuidMapService();
         }
         if (gObjects == null)
         {
             gObjects = new Objects();
         }
         if (gOnlineFeatures == null)
         {
             gOnlineFeatures = new OnlineFeatures();
         }
         //if (gProfilerUtils == null) gProfilerUtils = new ProfilerUtils();
         if (gQueries == null)
         {
             gQueries = new Queries();
         }
         if (gRandom == null)
         {
             gRandom = new ScriptCore.Random();
         }
         if (gReflection == null)
         {
             gReflection = new ScriptCore.Reflection();
         }
         if (gRouteManager == null)
         {
             gRouteManager = new RouteManager();
         }
         if (gSACS == null)
         {
             gSACS = new SACS();
         }
         if (gSimulator == null)
         {
             gSimulator = new Simulator();
         }
         if (gSlots == null)
         {
             gSlots = new Slots();
         }
         if (gSocialFeatures == null)
         {
             gSocialFeatures = new SocialFeatures();
         }
         if (gStopWatch == null)
         {
             gStopWatch = new StopWatch();
         }
         if (gStreamHost == null)
         {
             gStreamHost = new StreamHost();
         }
         if (gSwarm == null)
         {
             gSwarm = new Swarm();
         }
         if (gThumbnailManager == null)
         {
             gThumbnailManager = new ThumbnailManager();
         }
         if (gUIManager == null)
         {
             gUIManager = new UIManager();
         }
         if (gUserToolUtils == null)
         {
             gUserToolUtils = new UserToolUtils();
         }
         if (gVideoRecorder == null)
         {
             gVideoRecorder = new VideoRecorder();
         }
         if (gWorld == null)
         {
             gWorld = new World();
         }
         // Will this still be reached if any of the constructors throw an Exception? Hopefully not
         sInitialized = true;
     }
 }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     VideoRecorder.Hide();
 }
 private async void Closing_Click(object sender, RoutedEventArgs e)
 {
     VideoRecorder.Hide();
 }
Beispiel #17
0
 public static void StopRecording()
 {
     VideoRecorder.Destroy(videoRecorder);
     NatCorder.StopRecording();
 }
Beispiel #18
0
 public void Setup(VideoRecorder recorder, Material material)
 {
     videoRecorder    = recorder;
     externalMaterial = material;
 }
Beispiel #19
0
 public void SetInstance()
 {
     inst = this;
 }
 public void Setup()
 {
     recorder = new VideoRecorder();
 }
Beispiel #21
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            //deviceHandler = new RawInputDevices(this.Handle);

            if (Debugger.IsAttached)
            {
                // project file for debugging
                try
                {
                    using (var stream = File.Open("Data/results.bin", FileMode.Open))
                    {
                        var binaryFormatter = new BinaryFormatter();
                        resultList = (List <TimerResult>)binaryFormatter.Deserialize(stream);
                        resultList.Sort((x, y) => y.DateTime.CompareTo(x.DateTime));

                        foreach (var result in resultList)
                        {
                            resultsListBox.Items.Add(result);
                        }
                    }
                }
                catch (Exception)
                {
                    resultList = new List <TimerResult>();
                }
            }
            else
            {
                // isolated storage
                try
                {
                    using (var appScope = IsolatedStorageFile.GetUserStoreForApplication())
                    {
                        using (var stream = new IsolatedStorageFileStream("results.bin", FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite, appScope))
                        {
                            var binaryFormatter = new BinaryFormatter();
                            resultList = (List <TimerResult>)binaryFormatter.Deserialize(stream);
                            resultList.Sort((x, y) => y.DateTime.CompareTo(x.DateTime));

                            foreach (var result in resultList)
                            {
                                resultsListBox.Items.Add(result);
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    resultList = new List <TimerResult>();
                }
            }

            preparationTime  = Int32.Parse(ConfigurationManager.AppSettings["preparationTime"]);
            inputPenalties   = Boolean.Parse(ConfigurationManager.AppSettings["inputPenalties"]);
            recordSplitTimes = Boolean.Parse(ConfigurationManager.AppSettings["recordSplitTimes"]);
            country          = (CountryCode)Enum.Parse(typeof(CountryCode), ConfigurationManager.AppSettings["country"]);
            recording        = Boolean.Parse(ConfigurationManager.AppSettings["recordVideos"]);
            cameras          = DelimitedStringToCameraInfoList(ConfigurationManager.AppSettings["cameras"]);
            streamUrls       = DelimitedStringToStringList(ConfigurationManager.AppSettings["streamUrls"]);

            videoRecorders = new List <VideoRecorder>();
            for (var i = 0; i < cameras.Count; i++)
            {
                var videoRecorder = new VideoRecorder(cameras[i]);
                videoRecorder.OnConnect += OnVideoCameraConnect;
                videoRecorders.Add(videoRecorder);
            }

            if (recordSplitTimes)
            {
                ShowSplitTimesForm();
            }

            this.webcamStatusPictureBox.Visible = recording;
        }
Beispiel #22
0
 public void BeforeScenario()
 {
     VideoRecorder.StartRecordingVideo(ScenarioContext.Current.ScenarioInfo.Title);
     Driver.OpenBrowser(browserName);
     Driver.Visit(baseURL);
 }
Beispiel #23
0
 public Form1()
 {
     InitializeComponent();
     recorder = new VideoRecorder(frameHandler);
     recorder.startRecording();
 }
Beispiel #24
0
        public void TearDownTest()
        {
            bool videoRecordEnabled = false;

            try
            {
                videoRecordEnabled = ConfigurationManager.AppSettings["VIDEO_RECORDING_ENABLED"].Equals("1");
                if (videoRecordEnabled)
                {
                    VideoRecorder.EndRecording();
                }

                //Prepara result block para o report
                string testResult      = String.Format("<p>{0}</p>", TestContext.CurrentContext.Result.Message);
                var    status          = TestContext.CurrentContext.Result.Outcome.Status;
                string stackTrace      = String.Format("<p>{0}</p>", TestContext.CurrentContext.Result.StackTrace);
                string screenshotBytes = ScreenShot.CaptureAsBase64EncodedString();
                string imgTag          = "<br/>" +
                                         "<img src='data:image/jpg; base64, " + screenshotBytes + "' " +
                                         "style='width:100%'>";
                string fullTestResult =
                    testResult +
                    stackTrace +
                    imgTag;

                if (ConfigurationManager.AppSettings["VIDEO_RECORDING_ENABLED"].Equals("1"))
                {
                    string videoTag = "<br/>" +
                                      "<video controls style='width:100%'> " +
                                      "<source type='video/mp4' src='data:video/mp4;base64," + VideoRecorder.GetVideoRecordedAsBase64StringAndDeleteLocalFile() + "'> " +
                                      "</video>";
                    fullTestResult +=
                        videoTag;
                }

                switch (status)
                {
                case NUnit.Framework.Interfaces.TestStatus.Failed:
                    Reporter.GetInstance().FailTest(fullTestResult);
                    Reporter.GetInstance().failedTests++;
                    break;

                default:
                    Reporter.GetInstance().PassTest(fullTestResult);
                    Reporter.GetInstance().passedTests++;
                    break;
                }

                WebDriverHooks.Driver.Quit();
            }
            catch (ConfigurationErrorsException)
            {
            }
        }