ios_screen_recorder 0.0.5 copy "ios_screen_recorder: ^0.0.5" to clipboard
ios_screen_recorder: ^0.0.5 copied to clipboard

outdated

Screen Recorder plugin is for iOS.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:screen_recorder/screen_recorder.dart';

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

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

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

class _MyAppState extends State<MyApp> {
  String _urlText = 'Unknown';
  final _screenRecorderPlugin = ScreenRecorder();

  @override
  void initState() {
    super.initState();
    startRecord();
  }
// Void
  Future<void> startRecord() async {
    String result;
    String dirPath = ''; // Add path to save the video.
    try {
      result =
          await _screenRecorderPlugin.startScreenRecord(dirPath) ?? 'Start recording failure.';
      setState(() {
        _urlText = result;
      });
    } on PlatformException {
      result = 'Failed to get platform version.';
    }
  }

  Future<void> stopRecord() async {
    String result;
    try {
      result =
          await _screenRecorderPlugin.stopScreenRecord() ?? 'Stop recording failure.';
      setState(() {
        _urlText = result;
      });
    } on PlatformException {
      result = 'Failed to get platform version.';
    }
  }


  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Screen Recorder Plugin example'),
        ),
        body: Center(
          child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [Text('VideoUrl: $_urlText\n'),
          ElevatedButton(onPressed: (){
                stopRecord();
          }, child: const Text('STOP Record'))
          ]),
        ),
      ),
    );
  }
}
0
likes
0
points
14
downloads

Publisher

unverified uploader

Weekly Downloads

Screen Recorder plugin is for iOS.

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on ios_screen_recorder

Packages that implement ios_screen_recorder