internal_audio_recorder 0.1.2 copy "internal_audio_recorder: ^0.1.2" to clipboard
internal_audio_recorder: ^0.1.2 copied to clipboard

A new Flutter plugin for android that record internal audio and output it as PCM file.

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:internal_audio_recorder/internal_audio_recorder.dart';
import 'package:internal_audio_recorder/model/audioformat.dart';
import 'package:path_provider/path_provider.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _internalAudioRecorderPlugin = InternalAudioRecorder();

  @override
  void initState() {
    super.initState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              MaterialButton(
                color: Colors.green,
                onPressed: () async {
                  var document = await getTemporaryDirectory();
                  var storagePath = "${document.path}/opm.pcm";
                  var file = File(storagePath);
                  await file.create();
                  var responce =
                      await _internalAudioRecorderPlugin.startCapturing(
                          file.path, AudioFormat.encodingPCM16BIT, 44200);

                  print("Responce: $responce");
                },
                child: Text("Start Recording"),
              ),
              MaterialButton(
                color: Colors.green,
                onPressed: () async {
                  var responce =
                      await _internalAudioRecorderPlugin.stopCapturing();

                  print("Responce: $responce");
                },
                child: Text("Stop Recording"),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
2
likes
0
points
29
downloads

Publisher

unverified uploader

Weekly Downloads

A new Flutter plugin for android that record internal audio and output it as PCM file.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on internal_audio_recorder