Files
AZTECH_WB/Assets/Scripts/Wrapper/CaptureRecoder.cs
정영민 70515575f5 [정영민] 로그인 기능 수정
26.03.12
- 로그인 단축키 기능 추가
2026-03-16 08:54:59 +09:00

51 lines
1.2 KiB
C#

using RenderHeads.Media.AVProMovieCapture;
using SFB;
using System.IO;
using UnityEngine;
namespace AZTECHWB.Wrapper
{
public class CaptureRecoder
{
private CaptureBase capture;
public void Setup()
{
capture = GameObject.FindFirstObjectByType<CaptureBase>();
capture.CameraRenderResolution = CaptureBase.Resolution.Custom;
capture.CompletedFileWritingAction += OnCaptureCompleted;
}
public void SetRecordStatus(bool isStart)
{
if (isStart)
{
capture.StartCapture();
}
else
{
capture.StopCapture();
}
}
private void OnCaptureCompleted(FileWritingHandler handler)
{
var sourcePath = handler.FinalPath;
var destFilePath = StandaloneFileBrowser.SaveFilePanel("Save File", "", "", "mp4");
if (!string.IsNullOrEmpty(destFilePath))
{
if (File.Exists(destFilePath))
File.Delete(destFilePath);
File.Move(sourcePath, destFilePath);
}
else
{
File.Delete(sourcePath);
}
}
}
}