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

Audio Resumes #1824

Open
2 tasks done
Copperbolt25 opened this issue Aug 1, 2024 · 1 comment
Open
2 tasks done

Audio Resumes #1824

Copperbolt25 opened this issue Aug 1, 2024 · 1 comment
Labels

Comments

@Copperbolt25
Copy link

Checklist

  • I read the troubleshooting guide before raising this issue
  • I made sure that the issue I am raising doesn't already exist

Current bug behaviour

From Version 5.0.0> i have an audio file which plays whenever an order is landed on the app. I pause the audio when the user accepts the order.
Now the issue is, the audio stops however if I go back and open instagram, play any reel with an audio, the sound previously paused starts again.

Expected behaviour

It should not unpause the sound

Steps to reproduce

  1. Execute flutter run on the code sample
  2. ...
  3. ...

run the function that starts the sound,
then use anther function to pause the sound.

and then go to instagram, play any reel with sound, close it and then the sound is resumed from the app again.

Code sample

void playNewOrderSound(int timeInSeconds) async {
registeredLogService.info(text: "playing new order sound");
await newOrderAudioPlayer.pause().onError(
(error, stackTrace) => registeredLogService.error(error: error));
await newOrderAudioPlayer.resume().onError(
(error, stackTrace) => registeredLogService.error(error: error));
_vibrationTimer?.cancel();
_stopAudioBackupTimer?.cancel();
isNewOrderPlaying = true;
_vibrationTimer = Timer.periodic(
const Duration(milliseconds: 1000),
(timer) {
Vibration.vibrate(duration: 450);
},
);
_stopAudioBackupTimer = Timer(
Duration(
seconds: timeInSeconds,
),
() => stopNewOrderSound(),
);
}

void stopNewOrderSound() {
registeredLogService.info(text: "stopping new order sound");
isNewOrderPlaying = false;
_stopAudioBackupTimer?.cancel();
newOrderAudioPlayer.pause();
_vibrationTimer?.cancel();
}

Affected platforms

Android

Platform details

No response

AudioPlayers Version

5.0.0,6.0.0

Build mode

release

Audio Files/URLs/Sources

No response

Screenshots

No response

Logs

my relevant logs
Full Logs
my full logs or a link to a gist

Flutter doctor:

Output of: flutter doctor -v

Related issues / more information

No response

Working on PR

no way

@Henriquek47
Copy link

any updated?

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

No branches or pull requests

2 participants