Flutter API to record video

Viewed 298

Flutter has no way to record video of the Flutter App.

I tried all the following, all have majors drawbacks that brings to ask this question

Using repaintBoundary

This method has 2 major drawbacks:

  1. It draws blank white boxes on PlatformViews and WebViews (https://github.com/flutter/flutter/issues/25306 and Update 30 June https://github.com/flutter/flutter/issues/83856 it is in progress this quarter)
  2. Bitmaps need to be sent back to the Native platform for encoding into mp4. (Using OpenGL)

Using native platform

Flutter exposes the getBitmap API that is meant be used on the Native Platform to capture a screenshot of the Running hosted Flutter App but this has 2 major drawbacks

  1. It must run on UIThread so the FlutterApp is blocked, so the video is recording a blocked UI
  2. This method is very slow. Sometimes up to 100 ms per frame depending on the screen content.

Recording the entire screen?

Using MediaRecorder that's possible but we want to:

  1. Record the app only, not the entire screen
  2. Recording the entire screen requires special permission from user

Drawing a canvas of the FlutterView in the Native platform?

This draws black screen because FlutterView is a SurfaceView and bitmap cannot be obtained as it was drawn on the different thread.

Use PixelCopy?

This API is only availabe on >= API 24

Does FLutter Expose an API to record Bitmaps continuously in the background not on the Main UI thread . (Or a video recording API but that's too much to ask)

Keywords: getBitmap, screenshot, bitmap, uithread, background, record, recording, screen shot, main thread, flutterview, surfaceview, video, mp4, mediarecorder, opengl, mediamuxer, mediaencoder

0 Answers
Related