mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 14:59:29 +01:00
fix: Keep display alive while recording
This commit is contained in:
parent
b3e3419508
commit
ddba6c2ad6
@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:record/record.dart';
|
import 'package:record/record.dart';
|
||||||
|
import 'package:wakelock/wakelock.dart';
|
||||||
|
|
||||||
class RecordingDialog extends StatefulWidget {
|
class RecordingDialog extends StatefulWidget {
|
||||||
static const String recordingFileType = 'aac';
|
static const String recordingFileType = 'aac';
|
||||||
@ -35,6 +36,7 @@ class _RecordingDialogState extends State<RecordingDialog> {
|
|||||||
setState(() => error = true);
|
setState(() => error = true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
await Wakelock.enable();
|
||||||
await _audioRecorder.start(
|
await _audioRecorder.start(
|
||||||
path: _recordedPath, encoder: AudioEncoder.AAC);
|
path: _recordedPath, encoder: AudioEncoder.AAC);
|
||||||
setState(() => _duration = Duration.zero);
|
setState(() => _duration = Duration.zero);
|
||||||
@ -55,6 +57,7 @@ class _RecordingDialogState extends State<RecordingDialog> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
Wakelock.disable();
|
||||||
_recorderSubscription?.cancel();
|
_recorderSubscription?.cancel();
|
||||||
_audioRecorder.stop();
|
_audioRecorder.stop();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
@ -1501,7 +1501,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0+11"
|
version: "1.2.0+11"
|
||||||
wakelock:
|
wakelock:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: wakelock
|
name: wakelock
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
|
@ -68,6 +68,7 @@ dependencies:
|
|||||||
universal_html: ^2.0.8
|
universal_html: ^2.0.8
|
||||||
url_launcher: ^6.0.9
|
url_launcher: ^6.0.9
|
||||||
vrouter: 1.2.0+11
|
vrouter: 1.2.0+11
|
||||||
|
wakelock: ^0.5.3+3
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
dapackages: ^1.6.0
|
dapackages: ^1.6.0
|
||||||
|
Loading…
Reference in New Issue
Block a user