Skip to content

[HELP]: I can't play paused recording in flutter web #1145

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

Open
mihailovukojicic opened this issue Jan 9, 2025 · 10 comments
Open

[HELP]: I can't play paused recording in flutter web #1145

mihailovukojicic opened this issue Jan 9, 2025 · 10 comments
Labels
help wanted Extra attention is needed Not yet handled

Comments

@mihailovukojicic
Copy link

mihailovukojicic commented Jan 9, 2025

I need Help for :

  • Using the API

Here is my question :

I can't play paused recording.

LOGS

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ #0   packages/flutter_sound/public/flutter_sound_player.dart 1145:5      _stop
│ #1   packages/flutter_sound/public/flutter_sound_player.dart 1144:21     [_stop]
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ 🐛 FS:---> _stop 
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ #0   packages/flutter_sound/public/flutter_sound_player.dart 313:5                     stopPlayerCompleted
│ #1   packages/flutter_sound_web/flutter_sound_player_web.dart 159:7                    <fn>
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ 🐛 ---> stopPlayerCompleted: true
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ #0   packages/flutter_sound/public/flutter_sound_player.dart 328:5                     stopPlayerCompleted
│ #1   packages/flutter_sound_web/flutter_sound_player_web.dart 159:7                    <fn>
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ 🐛 <--- stopPlayerCompleted: true
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ #0   packages/flutter_sound/public/flutter_sound_player.dart 1172:5      _stop
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ 🐛 FS:<--- _stop 
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ #0   packages/flutter_sound/public/flutter_sound_player.dart 377:5       log
│ #1   packages/flutter_sound_web/flutter_sound_player_web.dart 326:13     startPlayer
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ 🐛 startPlayer FromURI : audio_record.mp4
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ #0   packages/flutter_sound/public/flutter_sound_player.dart 847:5       _startPlayer
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ 🐛 FS:<--- startPlayer 
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ #0   packages/flutter_sound/public/flutter_sound_player.dart 377:5                     log
│ #1   packages/flutter_sound_web/flutter_sound_player_web.dart 168:7                    <fn>
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
│ 💡 onloaderror

Method for starting the playback

void _startPlayback() {
    setState(() {
      isRecordingPlayed = true;
    });
    _mPlayer.setSubscriptionDuration(const Duration(milliseconds: 100));
    _mPlayer.onProgress!.listen((event) {
      setState(() {
        playbackProgress =
            event.position.inMilliseconds / event.duration.inMilliseconds;
      });
    });

    _mPlayer.startPlayer(
      fromURI: _mPath,
      whenFinished: () => setState(() {
        playbackProgress = 1.0;
        isRecordingPlayed = false;
      }),
    );
  }
@mihailovukojicic mihailovukojicic added help wanted Extra attention is needed Not yet handled labels Jan 9, 2025
@Larpoux
Copy link
Collaborator

Larpoux commented Jan 9, 2025

Are you sure that _mPath is a valid file that is accessible and has a valid codec.
You should launch your app through Chrome, and look to the chrome debugger. You may have a more detailed error message.

@mihailovukojicic
Copy link
Author

When I go with the flow

  1. Start recording
  2. Stop recording
  3. Play recording from the method above

Everything is working like a charm, only when I pause the recording, it won't play the current recording that is paused.

@Larpoux
Copy link
Collaborator

Larpoux commented Jan 10, 2025

Do you record to File, to Buffer or to Stream ?

@mihailovukojicic
Copy link
Author

mihailovukojicic commented Jan 10, 2025

Screenshot 2025-01-10 at 09 18 06
to file.

@Larpoux
Copy link
Collaborator

Larpoux commented Jan 10, 2025

You are recording to the _mPath file, with the _mCodec codec.
The file is invalid until it is stopped.

@mihailovukojicic
Copy link
Author

So I have to change the logic to use toStream to process recording in real time?

@Larpoux
Copy link
Collaborator

Larpoux commented Jan 10, 2025

Yes, you will not have this issue if you record to stream

@mihailovukojicic
Copy link
Author

Thank you for the quick and kind response!

@mihailovukojicic
Copy link
Author

Is the toStream method working in flutter web for flutter_sound: 9.4.7?

@Larpoux
Copy link
Collaborator

Larpoux commented Jan 10, 2025

No, not yet. Just in the future v10.0.
But I am going to try to downport this feature to the v9.x because v10 will not be released soon.
I will post something on this thread later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed Not yet handled
Projects
None yet
Development

No branches or pull requests

2 participants