screen_record_flutter

Flutter plugin to record the screen for user analytics.

  • Getting Started
  • Installation
  • Requirements
  • Usage

Getting Started

Installation

Add this to dependencies in your pubspec.yaml file.

 screen_record_flutter: ^0.0.1+3

Requirements

  • Add the following in the manifest

      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
      <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    

Usage:

Import package,

import ‘package: screen_record_flutter/screen_record_flutter.dart’
  • To start the record :

      void startRecording() async {
        final dir = '${(await _getSavedDir())}';
        await Directory(dir).create(recursive: true);
        final stem =
            '$dir/${DateTime.now().toIso8601String().replaceAll(".", "").replaceAll(":", "")}';
        pathData = '$stem.mp4';
        meta = '$stem.meta';
        log('RECORDED VIDEO PATH = $pathData');
        await _recorder
            .start(
          pathVideo: pathData,
          pathMetadata: meta,
        )
            .then((value) {
          log("RECORDING STARTED");
        });
      }
    
  • To stop the record :

    Automatically video will be saved, once we invoke this method.

      void stopRecording() {
         _recorder.stop().then((value) {
            log("RECORDING STOPPED");
         });
      }
    
  • To record a particular widget :

    Wrap that widget with ScreenRecordWidget, then we can invoke the above methods to record the videos.

  • To play the videos inside the app :

    ScreenRecordPlayerWidget. we can use this widget to play the video inside the app.

  • NOTE : Once app goes background without invoke stop method, videos will not be saved, to rectify the issue we can use flutter_fgbg package to know the state off the application. for more info refer the example tab.