using UnityEngine; using RenderHeads.Media.AVProMovieCapture; using System.IO; using System; /// /// 录屏 /// public class SaveVideoToPersistentData : MonoBehaviour { public CaptureBase _movieCapture = null; public bool isPlayer = false; public void StartCapture() { if (_movieCapture != null) { isPlayer = true; string _name = GlobalFlag.practiceSubjectID+ ".mp4"; Debug.Log("Name:" + _name); _movieCapture._Mp4Name = _name; _movieCapture.StartCapture(); } } public void StopCapture() { if (_movieCapture != null && isPlayer) { _movieCapture.StopCapture(); } } private void OnDestroy() { StopCapture(); } }