Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cancelCompression now work #48

Closed
mbfakourii opened this issue Oct 10, 2020 · 2 comments
Closed

cancelCompression now work #48

mbfakourii opened this issue Oct 10, 2020 · 2 comments

Comments

@mbfakourii
Copy link

hi VideoCompress.cancelCompression not work please fix

my code

main() async {
  runApp(
    MyApp(),
  );
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Subscription _subscription;

  @override
  void initState() {
    super.initState();
    _subscription = VideoCompress.compressProgress$.subscribe((progress) {
      debugPrint('progress: $progress');
    });
  }

  @override
  void dispose() {
    super.dispose();
    _subscription.unsubscribe();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: Center(
          child: Column(
        children: [
          SizedBox(
            height: 200,
          ),
          FlatButton(
              onPressed: () async {
                print("t");
                VideoCompress.cancelCompression();
              },
              child: Text(
                "Stop",
                style: TextStyle(fontSize: 50),
              ))
        ],
      )),
      floatingActionButton: FloatingActionButton(
        onPressed: () async {
          MediaInfo mediaInfo = await VideoCompress.compressVideo(
            "/storage/emulated/0/3.mp4",
            quality: VideoQuality.LowQuality,
            deleteOrigin: false,
            includeAudio: true,
          );

          print("Compressor =  " + mediaInfo.path);
          setState(() {});
        },
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}

@yanivshaked
Copy link
Contributor

This issue was fixed and merged into the master

@jonataslaw
Copy link
Owner

Fix on lastest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants