Exemplo n.º 1
0
        public async void StopRecording()
        {
            offSound.Play();
            TimerOffObj.SetActive(true);
            TimerOnObj.SetActive(false);
            TimerOff.enabled = true;
            TimerOn.enabled  = false;

            Toast.Instance.Show("הסרטון נשמר בגלריה", 2);
            startRecordBtn.SetActive(true);
            stoprecordBtn.SetActive(false);
            // Mute microphone
            microphoneSource.mute = true;
            // Stop recording
            audioInput.Dispose();
            cameraInput.Dispose();
            var path = await recorder.FinishWriting();

            // Playback recording
            Debug.Log($"Saved recording to: {path}");
            //var prefix = Application.platform == RuntimePlatform.IPhonePlayer ? "file://" : "";
            //Handheld.PlayFullScreenMovie($"{prefix}{path}");
            //new NativeShare().AddFile(path).SetSubject("Subject goes here").SetText("Hello world!").Share();


            await new SavePayload().AddText("ReliveAR").AddMedia(path).Commit();

            StartCoroutine(Start());
            //StartCoroutine(loadscene(1.5F));
        }
Exemplo n.º 2
0
        public async void StopRecording()
        {
            // Stop recording
            recording = false;
            var path = await recorder.FinishWriting();

            // Playback recording
            Debug.Log($"Saved recording to: {path}");
            var prefix = Application.platform == RuntimePlatform.IPhonePlayer ? "file://" : "";
            //                Handheld.PlayFullScreenMovie($"{prefix}{path}");
        }
Exemplo n.º 3
0
        public async void StopRecording()
        {
            // Mute microphone
            microphoneSource.mute = true;
            // Stop recording
            audioInput?.Dispose();
            cameraInput.Dispose();
            var path = await recorder.FinishWriting();

            // Playback recording
            Debug.Log($"Saved recording to: {path}");
            Handheld.PlayFullScreenMovie($"file://{path}");
        }
    public async void StopVideoRecording()
    {
        // Mute microphone
        microphoneSource.mute = true;
        // Stop recording
        audioInput?.Dispose();
        cameraInput.Dispose();
        var path = await recorder.FinishWriting();

        // Log event and send a message to Flutter
        Debug.Log($"Saved recording to: {path}");
        UnityMessageManager.Instance.SendMessageToFlutter(path);
    }
        private async Task FinishRecording()
        {
            if (!isVideoRecording || isFinishWriting)
            {
                return;
            }

            // Mute microphone
            microphoneSource.mute = true;

            // Stop the microphone if we used it for recording
            if (recordMicrophoneAudio)
            {
                StopMicrophone();
                audioInput.Dispose();
                audioInput = null;
            }

            if (fpsMonitor != null)
            {
                fpsMonitor.consoleText = "FinishWriting...";
            }

            // Stop recording
            isFinishWriting = true;
            try
            {
                var path = await videoRecorder.FinishWriting();

                videoPath = path;
                Debug.Log("Saved recording to: " + videoPath);
                savePathInputField.text = videoPath;
            }
            catch (ApplicationException e)
            {
                Debug.Log(e.Message);
                savePathInputField.text = e.Message;
            }
            isFinishWriting = false;

            if (fpsMonitor != null)
            {
                fpsMonitor.consoleText = "";
            }

            ShowAllVideoUI();
            recordVideoButton.GetComponentInChildren <UnityEngine.UI.Text>().color = Color.black;

            isVideoRecording = false;
        }
        public async void StopRecording()
        {
            // Mute microphone
            microphoneSource.mute = true;
            // Stop recording
            audioInput?.Dispose();
            cameraInput.Dispose();
            var path = await recorder.FinishWriting();

            // Playback recording
            Debug.Log($"Saved recording to: {path}");
            var prefix = Application.platform == RuntimePlatform.IPhonePlayer ? "file://" : "";
//            Handheld.PlayFullScreenMovie($"{prefix}{path}");
        }
        public async void StopRecording()
        {
            if (microphoneActive)
            {
                StopMicrophone();
                audioInput?.Dispose();
            }

            cameraInput?.Dispose();

            string videoPath = await mediaRecorder.FinishWriting();

            OnRecordingFinished(videoPath);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Finish writing.
        /// </summary>
        /// <param name="recordingName">Desired recording name. This MUST include the file extension.</param>
        /// <param name="overwrite">Should any existing file be overwritten?</param>
        /// <returns>Path to recorded media file.</returns>
        public static async Task <string> FinishWriting(this IMediaRecorder recorder, string recordingName, bool overwrite = false)
        {
            // Get source and destination paths
            var src = await recorder.FinishWriting();

            var dst       = Path.Combine(new FileInfo(src).Directory.FullName, recordingName);
            var directory = File.GetAttributes(src).HasFlag(FileAttributes.Directory); // src and dst are same type
            var exists    = File.Exists(dst) || Directory.Exists(dst);

            // Delete existing file
            if (exists && overwrite)
            {
                if (directory)
                {
                    Directory.Delete(dst, true);
                }
                else
                {
                    File.Delete(dst);
                }
            }
            // Move
            try {
                if (directory)
                {
                    Directory.Move(src, dst);
                }
                else
                {
                    File.Move(src, dst);
                }
            }
            // Delete source
            catch (IOException ex) {
                if (directory)
                {
                    Directory.Delete(src, true);
                }
                else
                {
                    File.Delete(src);
                }
                throw ex;
            }
            // Return new path
            return(dst);
        }
Exemplo n.º 9
0
        public async void StopRecording()
        {
            // Mute microphone
            microphoneSource.mute = true;
            // Stop recording
            audioInput?.Dispose();
            cameraInput.Dispose();
            var path = await recorder.FinishWriting();

            // Playback recording
            Debug.Log($"Saved recording to: {path}");
            var prefix = Application.platform == RuntimePlatform.IPhonePlayer ? "file://" : "";

#if UNITY_EDITOR
            EditorUtility.OpenWithDefaultApp(path);
#elif UNITY_IOS
            Handheld.PlayFullScreenMovie("file://" + path);
#elif UNITY_ANDROID
            Handheld.PlayFullScreenMovie(path);
#endif
            // 移动端,录频完后,播放录制的视频
            //Handheld.PlayFullScreenMovie($"{prefix}{path}");
        }