start method

dynamic start()

Implementation

start() async {
  if (await _audioRecorder.hasPermission()) {
    var path = (await getApplicationDocumentsDirectory()).path;
    _path = '$path/$_dir/$_tag$_ext';
    File file = File(_path);
    if (!(await file.exists())) {
      await file.create(recursive: true);
    }
    await _audioRecorder.start(path: _path);
    _startTimestamp = _now();
    _timer?.cancel();
    _timer = null;
    _timer = Timer.periodic(Duration(seconds: 1), (timer) async {
      // _long = (_now() - _long) ~/ 1000;
      if (((_now() - _startTimestamp) ~/ 1000) >= maxRecordSec) {
        await stop(isInterrupt: true);
        onInterrupt(maxRecordSec, _path);
      }
    });
  }
}