Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
fff4e8d85b | ||
|
ae023d3f00 |
177
lib/audio_player.dart
Normal file
177
lib/audio_player.dart
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:audioplayers/audioplayers.dart' as ap;
|
||||||
|
import 'package:audioplayers/audioplayers.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class AudioPlayer extends StatefulWidget {
|
||||||
|
/// Path from where to play recorded audio
|
||||||
|
final String source;
|
||||||
|
|
||||||
|
/// Callback when audio file should be removed
|
||||||
|
/// Setting this to null hides the delete button
|
||||||
|
final VoidCallback onDelete;
|
||||||
|
|
||||||
|
const AudioPlayer({
|
||||||
|
super.key,
|
||||||
|
required this.source,
|
||||||
|
required this.onDelete,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
AudioPlayerState createState() => AudioPlayerState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class AudioPlayerState extends State<AudioPlayer> {
|
||||||
|
static const double _controlSize = 56;
|
||||||
|
static const double _deleteBtnSize = 24;
|
||||||
|
|
||||||
|
final _audioPlayer = ap.AudioPlayer()..setReleaseMode(ReleaseMode.stop);
|
||||||
|
late StreamSubscription<void> _playerStateChangedSubscription;
|
||||||
|
late StreamSubscription<Duration?> _durationChangedSubscription;
|
||||||
|
late StreamSubscription<Duration> _positionChangedSubscription;
|
||||||
|
Duration? _position;
|
||||||
|
Duration? _duration;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_playerStateChangedSubscription =
|
||||||
|
_audioPlayer.onPlayerComplete.listen((state) async {
|
||||||
|
await stop();
|
||||||
|
});
|
||||||
|
_positionChangedSubscription = _audioPlayer.onPositionChanged.listen(
|
||||||
|
(position) => setState(() {
|
||||||
|
_position = position;
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
_durationChangedSubscription = _audioPlayer.onDurationChanged.listen(
|
||||||
|
(duration) => setState(() {
|
||||||
|
_duration = duration;
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
_audioPlayer.setSource(_source);
|
||||||
|
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_playerStateChangedSubscription.cancel();
|
||||||
|
_positionChangedSubscription.cancel();
|
||||||
|
_durationChangedSubscription.cancel();
|
||||||
|
_audioPlayer.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return LayoutBuilder(
|
||||||
|
builder: (context, constraints) {
|
||||||
|
return Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: <Widget>[
|
||||||
|
_buildControl(),
|
||||||
|
_buildSlider(constraints.maxWidth),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.delete,
|
||||||
|
color: Color(0xFF73748D), size: _deleteBtnSize),
|
||||||
|
onPressed: () {
|
||||||
|
if (_audioPlayer.state == ap.PlayerState.playing) {
|
||||||
|
stop().then((value) => widget.onDelete());
|
||||||
|
} else {
|
||||||
|
widget.onDelete();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Text('${_duration ?? 0.0}'),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildControl() {
|
||||||
|
Icon icon;
|
||||||
|
Color color;
|
||||||
|
|
||||||
|
if (_audioPlayer.state == ap.PlayerState.playing) {
|
||||||
|
icon = const Icon(Icons.pause, color: Colors.red, size: 30);
|
||||||
|
color = Colors.red.withOpacity(0.1);
|
||||||
|
} else {
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
icon = Icon(Icons.play_arrow, color: theme.primaryColor, size: 30);
|
||||||
|
color = theme.primaryColor.withOpacity(0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ClipOval(
|
||||||
|
child: Material(
|
||||||
|
color: color,
|
||||||
|
child: InkWell(
|
||||||
|
child:
|
||||||
|
SizedBox(width: _controlSize, height: _controlSize, child: icon),
|
||||||
|
onTap: () {
|
||||||
|
if (_audioPlayer.state == ap.PlayerState.playing) {
|
||||||
|
pause();
|
||||||
|
} else {
|
||||||
|
play();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildSlider(double widgetWidth) {
|
||||||
|
bool canSetValue = false;
|
||||||
|
final duration = _duration;
|
||||||
|
final position = _position;
|
||||||
|
|
||||||
|
if (duration != null && position != null) {
|
||||||
|
canSetValue = position.inMilliseconds > 0;
|
||||||
|
canSetValue &= position.inMilliseconds < duration.inMilliseconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
double width = widgetWidth - _controlSize - _deleteBtnSize;
|
||||||
|
width -= _deleteBtnSize;
|
||||||
|
|
||||||
|
return SizedBox(
|
||||||
|
width: width,
|
||||||
|
child: Slider(
|
||||||
|
activeColor: Theme.of(context).primaryColor,
|
||||||
|
inactiveColor: Theme.of(context).colorScheme.secondary,
|
||||||
|
onChanged: (v) {
|
||||||
|
if (duration != null) {
|
||||||
|
final position = v * duration.inMilliseconds;
|
||||||
|
_audioPlayer.seek(Duration(milliseconds: position.round()));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
value: canSetValue && duration != null && position != null
|
||||||
|
? position.inMilliseconds / duration.inMilliseconds
|
||||||
|
: 0.0,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> play() => _audioPlayer.play(_source);
|
||||||
|
|
||||||
|
Future<void> pause() async {
|
||||||
|
await _audioPlayer.pause();
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> stop() async {
|
||||||
|
await _audioPlayer.stop();
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
|
||||||
|
Source get _source =>
|
||||||
|
kIsWeb ? ap.UrlSource(widget.source) : ap.DeviceFileSource(widget.source);
|
||||||
|
}
|
252
lib/audio_recorder.dart
Normal file
252
lib/audio_recorder.dart
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:record/record.dart';
|
||||||
|
|
||||||
|
import 'platform/audio_recorder_platform.dart';
|
||||||
|
|
||||||
|
class Recorder extends StatefulWidget {
|
||||||
|
final void Function(String path) onStop;
|
||||||
|
|
||||||
|
const Recorder({super.key, required this.onStop});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<Recorder> createState() => _RecorderState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _RecorderState extends State<Recorder> with AudioRecorderMixin {
|
||||||
|
int _recordDuration = 0;
|
||||||
|
Timer? _timer;
|
||||||
|
late final AudioRecorder _audioRecorder;
|
||||||
|
StreamSubscription<RecordState>? _recordSub;
|
||||||
|
RecordState _recordState = RecordState.stop;
|
||||||
|
StreamSubscription<Amplitude>? _amplitudeSub;
|
||||||
|
Amplitude? _amplitude;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_audioRecorder = AudioRecorder();
|
||||||
|
|
||||||
|
_recordSub = _audioRecorder.onStateChanged().listen((recordState) {
|
||||||
|
_updateRecordState(recordState);
|
||||||
|
});
|
||||||
|
|
||||||
|
_amplitudeSub = _audioRecorder
|
||||||
|
.onAmplitudeChanged(const Duration(milliseconds: 300))
|
||||||
|
.listen((amp) {
|
||||||
|
setState(() => _amplitude = amp);
|
||||||
|
});
|
||||||
|
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _start() async {
|
||||||
|
try {
|
||||||
|
if (await _audioRecorder.hasPermission()) {
|
||||||
|
const encoder = AudioEncoder.aacLc;
|
||||||
|
|
||||||
|
if (!await _isEncoderSupported(encoder)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final devs = await _audioRecorder.listInputDevices();
|
||||||
|
debugPrint(devs.toString());
|
||||||
|
|
||||||
|
const config = RecordConfig(encoder: encoder, numChannels: 1);
|
||||||
|
|
||||||
|
// Record to file
|
||||||
|
await recordFile(_audioRecorder, config);
|
||||||
|
|
||||||
|
// Record to stream
|
||||||
|
// await recordStream(_audioRecorder, config);
|
||||||
|
|
||||||
|
_recordDuration = 0;
|
||||||
|
|
||||||
|
_startTimer();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
if (kDebugMode) {
|
||||||
|
print(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _stop() async {
|
||||||
|
final path = await _audioRecorder.stop();
|
||||||
|
|
||||||
|
if (path != null) {
|
||||||
|
widget.onStop(path);
|
||||||
|
|
||||||
|
downloadWebData(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _pause() => _audioRecorder.pause();
|
||||||
|
|
||||||
|
Future<void> _resume() => _audioRecorder.resume();
|
||||||
|
|
||||||
|
void _updateRecordState(RecordState recordState) {
|
||||||
|
setState(() => _recordState = recordState);
|
||||||
|
|
||||||
|
switch (recordState) {
|
||||||
|
case RecordState.pause:
|
||||||
|
_timer?.cancel();
|
||||||
|
break;
|
||||||
|
case RecordState.record:
|
||||||
|
_startTimer();
|
||||||
|
break;
|
||||||
|
case RecordState.stop:
|
||||||
|
_timer?.cancel();
|
||||||
|
_recordDuration = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> _isEncoderSupported(AudioEncoder encoder) async {
|
||||||
|
final isSupported = await _audioRecorder.isEncoderSupported(
|
||||||
|
encoder,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!isSupported) {
|
||||||
|
debugPrint('${encoder.name} is not supported on this platform.');
|
||||||
|
debugPrint('Supported encoders are:');
|
||||||
|
|
||||||
|
for (final e in AudioEncoder.values) {
|
||||||
|
if (await _audioRecorder.isEncoderSupported(e)) {
|
||||||
|
debugPrint('- ${encoder.name}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return isSupported;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MaterialApp(
|
||||||
|
home: Scaffold(
|
||||||
|
body: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
_buildRecordStopControl(),
|
||||||
|
const SizedBox(width: 20),
|
||||||
|
_buildPauseResumeControl(),
|
||||||
|
const SizedBox(width: 20),
|
||||||
|
_buildText(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if (_amplitude != null) ...[
|
||||||
|
const SizedBox(height: 40),
|
||||||
|
Text('Current: ${_amplitude?.current ?? 0.0}'),
|
||||||
|
Text('Max: ${_amplitude?.max ?? 0.0}'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_timer?.cancel();
|
||||||
|
_recordSub?.cancel();
|
||||||
|
_amplitudeSub?.cancel();
|
||||||
|
_audioRecorder.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildRecordStopControl() {
|
||||||
|
late Icon icon;
|
||||||
|
late Color color;
|
||||||
|
|
||||||
|
if (_recordState != RecordState.stop) {
|
||||||
|
icon = const Icon(Icons.stop, color: Colors.red, size: 30);
|
||||||
|
color = Colors.red.withOpacity(0.1);
|
||||||
|
} else {
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
icon = Icon(Icons.mic, color: theme.primaryColor, size: 30);
|
||||||
|
color = theme.primaryColor.withOpacity(0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ClipOval(
|
||||||
|
child: Material(
|
||||||
|
color: color,
|
||||||
|
child: InkWell(
|
||||||
|
child: SizedBox(width: 56, height: 56, child: icon),
|
||||||
|
onTap: () {
|
||||||
|
(_recordState != RecordState.stop) ? _stop() : _start();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildPauseResumeControl() {
|
||||||
|
if (_recordState == RecordState.stop) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
|
||||||
|
late Icon icon;
|
||||||
|
late Color color;
|
||||||
|
|
||||||
|
if (_recordState == RecordState.record) {
|
||||||
|
icon = const Icon(Icons.pause, color: Colors.red, size: 30);
|
||||||
|
color = Colors.red.withOpacity(0.1);
|
||||||
|
} else {
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
icon = const Icon(Icons.play_arrow, color: Colors.red, size: 30);
|
||||||
|
color = theme.primaryColor.withOpacity(0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ClipOval(
|
||||||
|
child: Material(
|
||||||
|
color: color,
|
||||||
|
child: InkWell(
|
||||||
|
child: SizedBox(width: 56, height: 56, child: icon),
|
||||||
|
onTap: () {
|
||||||
|
(_recordState == RecordState.pause) ? _resume() : _pause();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildText() {
|
||||||
|
if (_recordState != RecordState.stop) {
|
||||||
|
return _buildTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
return const Text("Waiting to record");
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTimer() {
|
||||||
|
final String minutes = _formatNumber(_recordDuration ~/ 60);
|
||||||
|
final String seconds = _formatNumber(_recordDuration % 60);
|
||||||
|
|
||||||
|
return Text(
|
||||||
|
'$minutes : $seconds',
|
||||||
|
style: const TextStyle(color: Colors.red),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String _formatNumber(int number) {
|
||||||
|
String numberStr = number.toString();
|
||||||
|
if (number < 10) {
|
||||||
|
numberStr = '0$numberStr';
|
||||||
|
}
|
||||||
|
|
||||||
|
return numberStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _startTimer() {
|
||||||
|
_timer?.cancel();
|
||||||
|
|
||||||
|
_timer = Timer.periodic(const Duration(seconds: 1), (Timer t) {
|
||||||
|
setState(() => _recordDuration++);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,9 @@
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'audio_player.dart';
|
||||||
|
import 'audio_recorder.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
@ -57,10 +61,14 @@ class MyHomePage extends StatefulWidget {
|
|||||||
|
|
||||||
class _MyHomePageState extends State<MyHomePage> {
|
class _MyHomePageState extends State<MyHomePage> {
|
||||||
String _key = ' ';
|
String _key = ' ';
|
||||||
|
bool showPlayer = false;
|
||||||
|
bool record = false;
|
||||||
|
String? audioPath;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
showPlayer = false;
|
||||||
ServicesBinding.instance.keyboard.addHandler(_onKey);
|
ServicesBinding.instance.keyboard.addHandler(_onKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,11 +90,13 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
_key = " ";
|
_key = " ";
|
||||||
// check if the key is a letter between a and z
|
// check if the key is a letter between a and z
|
||||||
if (key.length == 1 && key.codeUnitAt(0) >= 65 && key.codeUnitAt(0) <= 90)
|
if (key.length == 1 && key.codeUnitAt(0) >= 65 && key.codeUnitAt(0) <= 90) {
|
||||||
_key = key;
|
_key = key;
|
||||||
|
}
|
||||||
// check if the key is a number between 0 and 9
|
// check if the key is a number between 0 and 9
|
||||||
if (key.length == 1 && key.codeUnitAt(0) >= 48 && key.codeUnitAt(0) <= 57)
|
if (key.length == 1 && key.codeUnitAt(0) >= 48 && key.codeUnitAt(0) <= 57) {
|
||||||
_key = key;
|
_key = key;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -134,36 +144,45 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
title: Text(widget.title),
|
title: Text(widget.title),
|
||||||
),
|
),
|
||||||
body: Center(
|
body: Center(
|
||||||
// Center is a layout widget. It takes a single child and positions it
|
child: record
|
||||||
// in the middle of the parent.
|
? showPlayer
|
||||||
child: Column(
|
? Padding(
|
||||||
// Column is also a layout widget. It takes a list of children and
|
padding: const EdgeInsets.symmetric(horizontal: 25),
|
||||||
// arranges them vertically. By default, it sizes itself to fit its
|
child: AudioPlayer(
|
||||||
// children horizontally, and tries to be as tall as its parent.
|
source: audioPath!,
|
||||||
//
|
onDelete: () {
|
||||||
// Column has various properties to control how it sizes itself and
|
setState(() => showPlayer = false);
|
||||||
// how it positions its children. Here we use mainAxisAlignment to
|
},
|
||||||
// center the children vertically; the main axis here is the vertical
|
),
|
||||||
// axis because Columns are vertical (the cross axis would be
|
)
|
||||||
// horizontal).
|
: Recorder(
|
||||||
//
|
onStop: (path) {
|
||||||
// TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
|
if (kDebugMode) print('Recorded file path: $path');
|
||||||
// action in the IDE, or press "p" in the console), to see the
|
setState(() {
|
||||||
// wireframe for each widget.
|
audioPath = path;
|
||||||
|
showPlayer = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
_key+" "+_key.toLowerCase(),
|
||||||
|
// set text color to white
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.lightGreen,
|
||||||
|
fontSize: 160.0, // Change this to your preferred color
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
_key+" "+_key.toLowerCase(),
|
||||||
|
// set text color to white
|
||||||
|
style: GoogleFonts.getFont('Dancing Script',color: Colors.lightGreen,fontSize: 160.0),
|
||||||
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
),
|
||||||
children: <Widget>[
|
],
|
||||||
Text(
|
|
||||||
'$_key',
|
|
||||||
// set text color to white
|
|
||||||
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.lightGreen,
|
|
||||||
fontSize: 160.0, // Change this to your preferred color
|
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: _incrementKey,
|
onPressed: _incrementKey,
|
||||||
|
47
lib/platform/audio_recorder_io.dart
Normal file
47
lib/platform/audio_recorder_io.dart
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:path/path.dart' as p;
|
||||||
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
import 'package:record/record.dart';
|
||||||
|
|
||||||
|
mixin AudioRecorderMixin {
|
||||||
|
Future<void> recordFile(AudioRecorder recorder, RecordConfig config) async {
|
||||||
|
final path = await _getPath();
|
||||||
|
|
||||||
|
await recorder.start(config, path: path);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> recordStream(AudioRecorder recorder, RecordConfig config) async {
|
||||||
|
final path = await _getPath();
|
||||||
|
|
||||||
|
final file = File(path);
|
||||||
|
|
||||||
|
final stream = await recorder.startStream(config);
|
||||||
|
|
||||||
|
stream.listen(
|
||||||
|
(data) {
|
||||||
|
// ignore: avoid_print
|
||||||
|
print(
|
||||||
|
recorder.convertBytesToInt16(Uint8List.fromList(data)),
|
||||||
|
);
|
||||||
|
file.writeAsBytesSync(data, mode: FileMode.append);
|
||||||
|
},
|
||||||
|
// ignore: avoid_print
|
||||||
|
onDone: () {
|
||||||
|
// ignore: avoid_print
|
||||||
|
print('End of stream. File written to $path.');
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void downloadWebData(String path) {}
|
||||||
|
|
||||||
|
Future<String> _getPath() async {
|
||||||
|
final dir = await getApplicationDocumentsDirectory();
|
||||||
|
return p.join(
|
||||||
|
dir.path,
|
||||||
|
'audio_${DateTime.now().millisecondsSinceEpoch}.m4a',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
1
lib/platform/audio_recorder_platform.dart
Normal file
1
lib/platform/audio_recorder_platform.dart
Normal file
@ -0,0 +1 @@
|
|||||||
|
export 'audio_recorder_web.dart' if (dart.library.io) 'audio_recorder_io.dart';
|
33
lib/platform/audio_recorder_web.dart
Normal file
33
lib/platform/audio_recorder_web.dart
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// ignore_for_file: avoid_web_libraries_in_flutter
|
||||||
|
|
||||||
|
import 'dart:html' as html;
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:record/record.dart';
|
||||||
|
|
||||||
|
mixin AudioRecorderMixin {
|
||||||
|
Future<void> recordFile(AudioRecorder recorder, RecordConfig config) {
|
||||||
|
return recorder.start(config, path: '');
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> recordStream(AudioRecorder recorder, RecordConfig config) async {
|
||||||
|
final b = <Uint8List>[];
|
||||||
|
final stream = await recorder.startStream(config);
|
||||||
|
|
||||||
|
stream.listen(
|
||||||
|
(data) => b.add(data),
|
||||||
|
onDone: () => downloadWebData(html.Url.createObjectUrl(html.Blob(b))),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void downloadWebData(String path) {
|
||||||
|
// Simple download code for web testing
|
||||||
|
final anchor = html.document.createElement('a') as html.AnchorElement
|
||||||
|
..href = path
|
||||||
|
..style.display = 'none'
|
||||||
|
..download = 'audio.wav';
|
||||||
|
html.document.body!.children.add(anchor);
|
||||||
|
anchor.click();
|
||||||
|
html.document.body!.children.remove(anchor);
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,14 @@
|
|||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
|
#include <audioplayers_linux/audioplayers_linux_plugin.h>
|
||||||
|
#include <record_linux/record_linux_plugin.h>
|
||||||
|
|
||||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||||
|
g_autoptr(FlPluginRegistrar) audioplayers_linux_registrar =
|
||||||
|
fl_plugin_registry_get_registrar_for_plugin(registry, "AudioplayersLinuxPlugin");
|
||||||
|
audioplayers_linux_plugin_register_with_registrar(audioplayers_linux_registrar);
|
||||||
|
g_autoptr(FlPluginRegistrar) record_linux_registrar =
|
||||||
|
fl_plugin_registry_get_registrar_for_plugin(registry, "RecordLinuxPlugin");
|
||||||
|
record_linux_plugin_register_with_registrar(record_linux_registrar);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
|
audioplayers_linux
|
||||||
|
record_linux
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||||
|
@ -5,6 +5,12 @@
|
|||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
import audioplayers_darwin
|
||||||
|
import path_provider_foundation
|
||||||
|
import record_darwin
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
|
AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin"))
|
||||||
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
|
RecordPlugin.register(with: registry.registrar(forPlugin: "RecordPlugin"))
|
||||||
}
|
}
|
||||||
|
342
pubspec.lock
342
pubspec.lock
@ -9,6 +9,62 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.11.0"
|
version: "2.11.0"
|
||||||
|
audioplayers:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: audioplayers
|
||||||
|
sha256: c05c6147124cd63e725e861335a8b4d57300b80e6e92cea7c145c739223bbaef
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.2.1"
|
||||||
|
audioplayers_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: audioplayers_android
|
||||||
|
sha256: b00e1a0e11365d88576320ec2d8c192bc21f1afb6c0e5995d1c57ae63156acb5
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.0.3"
|
||||||
|
audioplayers_darwin:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: audioplayers_darwin
|
||||||
|
sha256: "3034e99a6df8d101da0f5082dcca0a2a99db62ab1d4ddb3277bed3f6f81afe08"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.0.2"
|
||||||
|
audioplayers_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: audioplayers_linux
|
||||||
|
sha256: "60787e73fefc4d2e0b9c02c69885402177e818e4e27ef087074cf27c02246c9e"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.1.0"
|
||||||
|
audioplayers_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: audioplayers_platform_interface
|
||||||
|
sha256: "365c547f1bb9e77d94dd1687903a668d8f7ac3409e48e6e6a3668a1ac2982adb"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.1.0"
|
||||||
|
audioplayers_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: audioplayers_web
|
||||||
|
sha256: "22cd0173e54d92bd9b2c80b1204eb1eb159ece87475ab58c9788a70ec43c2a62"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.1.0"
|
||||||
|
audioplayers_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: audioplayers_windows
|
||||||
|
sha256: "9536812c9103563644ada2ef45ae523806b0745f7a78e89d1b5fb1951de90e1a"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.1.0"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -41,6 +97,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.18.0"
|
version: "1.18.0"
|
||||||
|
crypto:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: crypto
|
||||||
|
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.3"
|
||||||
cupertino_icons:
|
cupertino_icons:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -57,6 +121,30 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.1"
|
version: "1.3.1"
|
||||||
|
ffi:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: ffi
|
||||||
|
sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.0"
|
||||||
|
file:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file
|
||||||
|
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "7.0.0"
|
||||||
|
fixnum:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: fixnum
|
||||||
|
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.0"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -75,6 +163,67 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_web_plugins:
|
||||||
|
dependency: transitive
|
||||||
|
description: flutter
|
||||||
|
source: sdk
|
||||||
|
version: "0.0.0"
|
||||||
|
google_fonts:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: google_fonts
|
||||||
|
sha256: b1ac0fe2832c9cc95e5e88b57d627c5e68c223b9657f4b96e1487aa9098c7b82
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.2.1"
|
||||||
|
http:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: http
|
||||||
|
sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.2.0"
|
||||||
|
http_parser:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: http_parser
|
||||||
|
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.0.2"
|
||||||
|
js:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: js
|
||||||
|
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.6.7"
|
||||||
|
leak_tracker:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: leak_tracker
|
||||||
|
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "10.0.0"
|
||||||
|
leak_tracker_flutter_testing:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: leak_tracker_flutter_testing
|
||||||
|
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.1"
|
||||||
|
leak_tracker_testing:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: leak_tracker_testing
|
||||||
|
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.1"
|
||||||
lints:
|
lints:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -87,34 +236,154 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: matcher
|
name: matcher
|
||||||
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
|
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.16"
|
version: "0.12.16+1"
|
||||||
material_color_utilities:
|
material_color_utilities:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: material_color_utilities
|
name: material_color_utilities
|
||||||
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
|
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.5.0"
|
version: "0.8.0"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
|
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.0"
|
version: "1.11.0"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path
|
name: path
|
||||||
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
|
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.3"
|
version: "1.9.0"
|
||||||
|
path_provider:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider
|
||||||
|
sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.2"
|
||||||
|
path_provider_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_android
|
||||||
|
sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.2"
|
||||||
|
path_provider_foundation:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_foundation
|
||||||
|
sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.3.2"
|
||||||
|
path_provider_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_linux
|
||||||
|
sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.1"
|
||||||
|
path_provider_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_platform_interface
|
||||||
|
sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.2"
|
||||||
|
path_provider_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_windows
|
||||||
|
sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.1"
|
||||||
|
platform:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: platform
|
||||||
|
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.1.4"
|
||||||
|
plugin_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: plugin_platform_interface
|
||||||
|
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.8"
|
||||||
|
record:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: record
|
||||||
|
sha256: "5c8e12c692a4800b33f5f8b6c821ea083b12bfdbd031b36ba9322c40a4eeecc9"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.0.4"
|
||||||
|
record_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: record_android
|
||||||
|
sha256: "805ecaa232a671aff2ee9ec4730ef6addb97c548d2db6b1fbd5197f1d4f47a5a"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.4"
|
||||||
|
record_darwin:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: record_darwin
|
||||||
|
sha256: ee8cb1bb1712d7ce38140ecabe70e5c286c02f05296d66043bee865ace7eb1b9
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.1"
|
||||||
|
record_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: record_linux
|
||||||
|
sha256: "7d0e70cd51635128fe9d37d89bafd6011d7cbba9af8dc323079ae60f23546aef"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.7.1"
|
||||||
|
record_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: record_platform_interface
|
||||||
|
sha256: "3a4b56e94ecd2a0b2b43eb1fa6f94c5b8484334f5d38ef43959c4bf97fb374cf"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.2"
|
||||||
|
record_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: record_web
|
||||||
|
sha256: "24847cdbcf999f7a5762170792f622ac844858766becd0f2370ec8ae22f7526e"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.5"
|
||||||
|
record_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: record_windows
|
||||||
|
sha256: "39998b3ea7d8d28b04159d82220e6e5e32a7c357c6fb2794f5736beea272f6c3"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.2"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -128,6 +397,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.0"
|
version: "1.10.0"
|
||||||
|
sprintf:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: sprintf
|
||||||
|
sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "7.0.0"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -152,6 +429,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.2.0"
|
||||||
|
synchronized:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: synchronized
|
||||||
|
sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.1.0+1"
|
||||||
term_glyph:
|
term_glyph:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -168,6 +453,22 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.1"
|
version: "0.6.1"
|
||||||
|
typed_data:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: typed_data
|
||||||
|
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.3.2"
|
||||||
|
uuid:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: uuid
|
||||||
|
sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.3.3"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -176,6 +477,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.4"
|
version: "2.1.4"
|
||||||
|
vm_service:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: vm_service
|
||||||
|
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "13.0.0"
|
||||||
web:
|
web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -184,5 +493,22 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.3.0"
|
version: "0.3.0"
|
||||||
|
win32:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: win32
|
||||||
|
sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.2.0"
|
||||||
|
xdg_directories:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: xdg_directories
|
||||||
|
sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.4"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.2.6 <4.0.0"
|
dart: ">=3.2.6 <4.0.0"
|
||||||
|
flutter: ">=3.19.2"
|
||||||
|
@ -35,6 +35,10 @@ dependencies:
|
|||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
cupertino_icons: ^1.0.2
|
cupertino_icons: ^1.0.2
|
||||||
|
record: ^5.0.4
|
||||||
|
platform: ^3.1.4
|
||||||
|
audioplayers: ^5.2.1
|
||||||
|
google_fonts: ^6.2.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
@ -6,6 +6,12 @@
|
|||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
|
#include <audioplayers_windows/audioplayers_windows_plugin.h>
|
||||||
|
#include <record_windows/record_windows_plugin_c_api.h>
|
||||||
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
|
AudioplayersWindowsPluginRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("AudioplayersWindowsPlugin"));
|
||||||
|
RecordWindowsPluginCApiRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("RecordWindowsPluginCApi"));
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
|
audioplayers_windows
|
||||||
|
record_windows
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||||
|
Loading…
Reference in New Issue
Block a user