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

Android: Seeking while audio is in the paused state doesn't invoke onPositionChanged listeners #1259

Closed
MohammedGoder opened this issue Aug 29, 2022 · 1 comment · Fixed by #1265
Assignees
Labels
bug platform-android Affects the android platform

Comments

@MohammedGoder
Copy link

It behaves as intended on Windows but not on Android.

Problematic Implementation:

audioPlayer.seek(
  Duration(
    microseconds: max(
      0,
      min(
        ((details.localPosition.dx /
                    constraints.maxWidth) *
                duration.inMicroseconds)
            .toInt(),
        duration.inMicroseconds,
      ),
    ),
  ),
);

Hacky Solution:

audioPlayer.seek(
  Duration(
    microseconds: max(
      0,
      min(
        ((details.localPosition.dx /
                    constraints.maxWidth) *
                duration.inMicroseconds)
            .toInt(),
        duration.inMicroseconds,
      ),
    ),
  ),
).then((_) => audioPlayer.getCurrentPosition().then(
(position) => _playerPositionChanged(position as Duration)
));
@Gustl22
Copy link
Collaborator

Gustl22 commented Aug 31, 2022

Thanks, nice catch same problem for web.

I overlooked that duration is not available for web, but the position update after seeking actually works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug platform-android Affects the android platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants