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

1.1.1, 1.1.2, 1.1.3 are not working on iOS #16

Closed
kijka opened this issue Nov 29, 2022 · 4 comments
Closed

1.1.1, 1.1.2, 1.1.3 are not working on iOS #16

kijka opened this issue Nov 29, 2022 · 4 comments

Comments

@kijka
Copy link

kijka commented Nov 29, 2022

1.1.1, 1.1.2, 1.1.3 are not working on iOS. With 1.1.0, everything is good.

As you can see in the video, the microphone notification (orange circle on the top right) disappears after some time, and there is no output from the microphone in the logs.

video5783172824113876473.mp4

Here is the sample code to reproduce the issue. It looks the same as the example project:

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

class _MyAppState extends State<MyApp> {
  FlutterAudioCapture _plugin = new FlutterAudioCapture();

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

  Future<void> _startCapture() async {
    await _plugin.start(listener, onError, sampleRate: 41000, bufferSize: 3000);
  }

  Future<void> _stopCapture() async {
    await _plugin.stop();
  }

  void listener(dynamic obj) {
    print(obj);
  }

  void onError(Object e) {
    print(e);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Flutter Audio Capture Plugin'),
        ),
        body: Column(children: [
          Expanded(
              child: Row(
            children: [
              Expanded(
                  child: Center(
                      child: FloatingActionButton(
                          onPressed: _startCapture, child: Text("Start")))),
              Expanded(
                  child: Center(
                      child: FloatingActionButton(
                          onPressed: _stopCapture, child: Text("Stop")))),
            ],
          ))
        ]),
      ),
    );
  }
}

tested on iPhone 13 pro, 16.1.1

@kijka kijka changed the title 1.1.1 is not stable on iOS 1.1.1 is not working on iOS Nov 30, 2022
@kijka kijka changed the title 1.1.1 is not working on iOS 1.1.3 is not working on iOS Dec 19, 2022
@kijka kijka changed the title 1.1.3 is not working on iOS 1.1.1, 1.1.2, 1.1.3 are not working on iOS Dec 19, 2022
@srmncnk
Copy link
Collaborator

srmncnk commented Dec 20, 2022

Hi @vladsonkin. I looked at the code and came to the conclusion that probably first data does not arrive for you in time on iOS. I could not reproduce it on my SE2 though.

I added this PR, please test it out and report what happens: #19
You can add it via pubspec.yaml as a git reference.

By default on iOS you no longer wait for first data to arrive, it's a parameter however, should one want to invoke original behaviour. I also added a timeout for waiting for first data to arrive, if you want to experiment with that and extend it.

@kijka
Copy link
Author

kijka commented Dec 20, 2022

It works perfectly, thanks @srmanc Great work!

@ysak-y
Copy link
Owner

ysak-y commented Dec 24, 2022

Hi, I published version 1.1.4 with patch from #19 . Thank you for your contribution! @srmanc and @vladsonkin . Please try it :)
https://pub.dev/packages/flutter_audio_capture/versions

@kijka
Copy link
Author

kijka commented Dec 24, 2022

All good, thanks!

@kijka kijka closed this as completed Dec 24, 2022
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