mehranshoqi / voice_message_player

Play / Show voice messages in your Flutter application.
https://mehran.monster
MIT License
63 stars 100 forks source link

(-11850) Operation Stopped error on IOS #42

Open Saydaleivs opened 2 months ago

Saydaleivs commented 2 months ago

HI everyone, I'm using this package in my project, it is working awesome in Android devices but in IOS it didn't work)

Here is how im recording first

void _startRecording() async {
    try {
      if (!await record.hasPermission()) {
        WidgetFunction.showSnackBar(
            context, 'Please enable microphone from your settings');
        return;
      }

      final io.Directory? appDocDir = await getApplicationDocumentsDirectory();
      final fileName = 'record.m4a'; 
      final String audioFilePath = '${appDocDir!.path}/$fileName';

      await record.start(
        RecordConfig(
          encoder: AudioEncoder.aacLc,
          bitRate: 32000,
          sampleRate: 44100,
          numChannels: 1,
        ),
        path: audioFilePath,
      );
    } catch (e) {
      print('Error starting recording: $e');
    }
  }

and here is the VoiceMessageView widget

          VoiceMessageView(
            controller: VoiceController(
              cacheKey: audioUrl,
              audioSrc: audioUrl,
              maxDuration: const Duration(seconds: 10),
              isFile: false,
              onComplete: () {
                /// do something on complete
              },
              onPause: () {
                /// do something on pause
              },
              onPlaying: () {
                /// do something on playing
              },
              onError: (err) {
                /// do somethin on error

                print('error while playing audio: $err');
                WidgetFunction.showSnackBar(context, 'Error on playing $err');
              },
            ),
            innerPadding: 0,
            backgroundColor: widget.msgDto!.fromTarget != widget.userId
                ? Color.fromARGB(255, 230, 230, 230)
                : Color.fromARGB(255, 49, 147, 227),
            circlesTextStyle: TextStyle(
              color: const Color.fromRGBO(255, 255, 255, 1),
            ),
            counterTextStyle: TextStyle(
              color: widget.msgDto!.fromTarget == widget.userId
                  ? Color.fromARGB(255, 230, 230, 230)
                  : Color.fromARGB(255, 49, 147, 227),
            ),
            circlesColor: widget.msgDto!.fromTarget != widget.userId
                ? Color.fromARGB(255, 50, 143, 219)
                : Color.fromARGB(255, 50, 143, 219),
            activeSliderColor: widget.msgDto!.fromTarget == widget.userId
                ? Color.fromARGB(255, 230, 230, 230)
                : Color.fromARGB(255, 49, 147, 227),
          ),

I'm seeing the error only from SnackBar by alerting because im not using mac and i'm debugging it after release in Testflight, please if somebody can help me

nzackoya commented 2 weeks ago

Same here. Is this package still supported?

Simply start playing a remote file recorded by Android 14

Error messages

flutter: (-11800) The operation could not be completed
flutter: 
#0      AudioPlayer._load (package:just_audio/just_audio.dart:870:9)
<asynchronous suspension>
#1      AudioPlayer.load (package:just_audio/just_audio.dart:800:14)
<asynchronous suspension>
#2      AudioPlayer.setAudioSource (package:just_audio/just_audio.dart:775:18)
<asynchronous suspension>
#3      VoiceController.startPlaying (package:voice_message_package/src/voice_controller.dart:175:5)
<asynchronous suspension>

Device: Iphone 12 mini, Simulator iphone se OS: ios 17.5.1, ios 17.0 Flutter SDK version

[✓] Flutter (Channel stable, 3.19.6, on macOS 13.5.1 22G90 darwin-x64, locale en-GB) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [✓] Xcode - develop for iOS and macOS (Xcode 15.0) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.3) [✓] IntelliJ IDEA Community Edition (version 2022.3.2) [✓] Connected device (5 available) [✓] Network resources

• No issues found!

Additional context Recorded different audio files, with different encoders, bitrates and sampleRates on android using record package