Canardoux / flutter_sound

Flutter plugin for sound. Audio recorder and player.
Mozilla Public License 2.0
880 stars 575 forks source link

[BUG]: onProgress in Recorder always emit duration is zero on iOS #751

Open AnhJobChat opened 3 years ago

AnhJobChat commented 3 years ago

Flutter Sound Version :


Severity


Platforms you faced the error


Describe the bug onProgress in Recorder always emit duration is zero on iOS at ver 8.3.9

To Reproduce Steps to reproduce the behavior:

  1. startRecorder
  2. Check onProgress value

    Code: Init:

    _audioRecorder = await FlutterSoundRecorder().openAudioSession(
      category: SessionCategory.record,
      focus: AudioFocus.requestFocusAndDuckOthers,
    );
    await _audioRecorder!.setSubscriptionDuration(const Duration(milliseconds: 1000));
    _recorderSubscription = _audioRecorder?.onProgress?.listen((event) {
      print("AAA event: $event");
    });

    startRecorder

    _audioRecorder?.startRecorder(toFile: _path ?? "")

    Print log:

    flutter: AAA event: duration: 0:00:00.000000 decibels: 0.00015999999999999999
    flutter: AAA event: duration: 0:00:00.000000 decibels: 0.00015999999999999999
    flutter: AAA event: duration: 0:00:00.000000 decibels: 0.00015999999999999999
    flutter: AAA event: duration: 0:00:00.000000 decibels: 0.00015999999999999999

    _path is file created with extension is aac

    Logs!!!!

    (This is very important. Most of the time we cannot do anything if we do not have information on your bug). To activate the logs, you must instantiate your modules with the Log Level set to Level.debug :

    FlutterSoundPlayer myPlayer = FlutterSoundPlayer(logLevel: Level.debug);
    FlutterSoundRecorder myRecorder = FlutterSoundRecorder(logLevel: Level.debug);

    See this


mhstoller commented 3 years ago

Same problem as #517 - see the suggested workaround to use requestFocusAndDuckOthers

AnhJobChat commented 3 years ago

@mhstoller Still no luck. I have been changed all AudioFocus.

mhstoller commented 3 years ago

Please provide your new code sample with the change, including where you open the audio session and I'll have a look

AnhJobChat commented 3 years ago

@mhstoller Thank you, I have been updated my code

github-actions[bot] commented 11 months ago

This issue is stale because it has been open 90 days with no activity. Leave a comment or this will be closed in 7 days.