/// <summary> /// Create a video recording input from a game camera. /// </summary> /// <param name="recorder">Media recorder to receive video frames.</param> /// <param name="camera">Game camera to record.</param> public ScreenInput(WEBMRecorder recorder, Camera camera) { this.recorder = recorder; this.camera = camera; var(width, height) = recorder.frameSize; this.readbackBuffer = new Texture2D(width, height, TextureFormat.RGBA32, false, false); this.pixelBuffer = new byte[width * height * 4]; this.attachment = camera.gameObject.AddComponent <ScreenInputAttachment>(); attachment.StartCoroutine(OnFrame()); }
public void StartRecording() { // Start recording from main camera recorder = new WEBMRecorder(videoWidth, videoHeight, 30); screenInput = new ScreenInput(recorder, Camera.main); }