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

feat!: FramePositionUpdater & TimerPositionUpdater #1664

Merged
merged 5 commits into from
Oct 22, 2023

Conversation

Gustl22
Copy link
Collaborator

@Gustl22 Gustl22 commented Oct 7, 2023

Description

  • Make the position stream updates configurable via PositionUpdater:
    • By default the position stream is updated on every new frame with help of FramePositionUpdater.
    • If setting the AudioPlayer.positionUpdater to TimerPositionUpdater , the position stream is updated in the according interval.
  • The execution on the separate IO thread on Android was moved to the relevant code part in SoundPoolPlayer.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, refactor:,
    docs:, chore:, test:, ci: etc).
  • I have read the Contributor Guide and followed the process outlined for submitting PRs.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation and added dartdoc comments with ///, where necessary.
  • I have updated/added relevant examples in example.

Breaking Change

If the PR is a breaking change this should be indicated with suffix "!"
(for example, feat!:, fix!:). See Conventional Commit for details. -->

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

Migration instructions

Removed in audioplayers_platform_interface:

AudioEventType.position
AudioEvent.position

Related Issues

Closes #349
Closes #1525

@Gustl22 Gustl22 changed the title feat!: configurable position stream update interval feat!: Configurable position stream update interval Oct 16, 2023
@Gustl22 Gustl22 requested a review from spydon October 17, 2023 10:05
void _tick(Duration? timestamp) {
if (_isRunning) {
update();
_frameCallbackId = SchedulerBinding.instance.scheduleFrameCallback(_tick);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spydon as you're also working on flame, which also uses frame based updates (I think). Do you think this is a valid approach for providing a smooth experience to display position updates? Or should this be made optional and use a the TimerPositionUpdater as first option?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach should be good I think!

@Gustl22 Gustl22 changed the title feat!: Configurable position stream update interval feat!: FramePositionUpdater & TimerPositionUpdater Oct 17, 2023
@Gustl22 Gustl22 force-pushed the gustl22/349-configurable-position-updates branch from 0d7102f to 61a2b50 Compare October 17, 2023 12:06
@Gustl22 Gustl22 changed the base branch from v6 to main October 17, 2023 12:12
@Gustl22 Gustl22 changed the base branch from main to v6 October 17, 2023 12:12
@Gustl22 Gustl22 deleted the branch main October 17, 2023 12:41
@Gustl22 Gustl22 closed this Oct 17, 2023
@Gustl22 Gustl22 reopened this Oct 17, 2023
@Gustl22 Gustl22 changed the base branch from v6 to main October 17, 2023 12:45
…rable-position-updates

# Conflicts:
#	packages/audioplayers_android/android/src/main/kotlin/xyz/luan/audioplayers/player/SoundPoolPlayer.kt
@Gustl22 Gustl22 merged commit 1ea9353 into main Oct 22, 2023
7 checks passed
@Gustl22 Gustl22 deleted the gustl22/349-configurable-position-updates branch October 22, 2023 19:43
This was referenced Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants