flutter_screen_recorder_kl 0.1.1 copy "flutter_screen_recorder_kl: ^0.1.1" to clipboard
flutter_screen_recorder_kl: ^0.1.1 copied to clipboard

PlatformAndroid

Live-mux screen recorder plugin for Android with internal audio + mic mix and fast stop.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_screen_recorder_kl/flutter_screen_recorder_kl.dart';
import 'package:permission_handler/permission_handler.dart';

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

class RecorderExampleApp extends StatelessWidget {
  const RecorderExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: RecorderHome(),
    );
  }
}

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

  @override
  State<RecorderHome> createState() => _RecorderHomeState();
}

class _RecorderHomeState extends State<RecorderHome> {
  bool _recording = false;
  String _status = 'Idle';

  Future<void> _start() async {
    final mic = await Permission.microphone.request();
    await Permission.notification.request();
    if (!mic.isGranted) {
      setState(() => _status = 'Microphone permission denied');
      return;
    }
    try {
      await FlutterScreenRecorderKl.instance.startRecording();
      setState(() {
        _recording = true;
        _status = 'Recording...';
      });
    } catch (e) {
      setState(() => _status = 'Start failed: $e');
    }
  }

  Future<void> _stop() async {
    try {
      final path = await FlutterScreenRecorderKl.instance.stopRecording();
      setState(() {
        _recording = false;
        _status = 'Saved: $path';
      });
    } catch (e) {
      setState(() {
        _recording = false;
        _status = 'Stop failed: $e';
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('flutter_screen_recorder_kl')),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(16),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text(_status, textAlign: TextAlign.center),
              const SizedBox(height: 16),
              ElevatedButton(
                onPressed: _recording ? null : _start,
                child: const Text('Start Recording'),
              ),
              const SizedBox(height: 12),
              ElevatedButton(
                onPressed: _recording ? _stop : null,
                child: const Text('Stop Recording'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
150
points
55
downloads

Publisher

unverified uploader

Weekly Downloads

Live-mux screen recorder plugin for Android with internal audio + mic mix and fast stop.

Repository (GitHub)
View/report issues

Topics

#screen-recorder #media-projection #android #audio

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_screen_recorder_kl

Packages that implement flutter_screen_recorder_kl