|
|
|
|
@ -1,15 +1,14 @@
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
|
|
import 'package:fluffychat/config/app_config.dart';
|
|
|
|
|
import 'package:fluffychat/utils/platform_infos.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
|
import 'package:path_provider/path_provider.dart';
|
|
|
|
|
import 'package:record/record.dart';
|
|
|
|
|
import 'package:wakelock_plus/wakelock_plus.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:fluffychat/config/app_config.dart';
|
|
|
|
|
import 'package:fluffychat/utils/platform_infos.dart';
|
|
|
|
|
import 'events/audio_player.dart';
|
|
|
|
|
|
|
|
|
|
class RecordingDialog extends StatefulWidget {
|
|
|
|
|
@ -28,7 +27,10 @@ class RecordingDialogState extends State<RecordingDialog> {
|
|
|
|
|
|
|
|
|
|
bool error = false;
|
|
|
|
|
String? _recordedPath;
|
|
|
|
|
final _audioRecorder = Record();
|
|
|
|
|
// #Pangea
|
|
|
|
|
// final _audioRecorder = Record();
|
|
|
|
|
final _audioRecorder = AudioRecorder();
|
|
|
|
|
// Pangea#
|
|
|
|
|
final List<double> amplitudeTimeline = [];
|
|
|
|
|
|
|
|
|
|
static const int bitRate = 64000;
|
|
|
|
|
@ -53,13 +55,21 @@ class RecordingDialogState extends State<RecordingDialog> {
|
|
|
|
|
(await _audioRecorder.isEncoderSupported(AudioEncoder.opus))
|
|
|
|
|
? AudioEncoder.opus
|
|
|
|
|
: AudioEncoder.aacLc;
|
|
|
|
|
|
|
|
|
|
// #Pangea
|
|
|
|
|
// await _audioRecorder.start(
|
|
|
|
|
// path: _recordedPath,
|
|
|
|
|
// bitRate: bitRate,
|
|
|
|
|
// samplingRate: samplingRate,
|
|
|
|
|
// );
|
|
|
|
|
await _audioRecorder.start(
|
|
|
|
|
encoder: audioCodec,
|
|
|
|
|
path: _recordedPath,
|
|
|
|
|
bitRate: bitRate,
|
|
|
|
|
samplingRate: samplingRate,
|
|
|
|
|
RecordConfig(
|
|
|
|
|
encoder: audioCodec,
|
|
|
|
|
bitRate: bitRate,
|
|
|
|
|
// samplingRate: samplingRate,
|
|
|
|
|
),
|
|
|
|
|
path: _recordedPath!,
|
|
|
|
|
);
|
|
|
|
|
// Pangea#
|
|
|
|
|
setState(() => _duration = Duration.zero);
|
|
|
|
|
_recorderSubscription?.cancel();
|
|
|
|
|
_recorderSubscription =
|
|
|
|
|
|