Skip to content

Conversation

@guneyozsan
Copy link

@guneyozsan guneyozsan commented Oct 11, 2025

Description

In order to get the duration of the audio pooled, it needs to create a new player for the source, causing unnecessary file/source reads. This PR aims to conveniently get duration from an already created pool, without using extra resources.

Adds getDuration() method to AudioPool.

  • When duration is requested the first time, it uses the pool to get or create an available player, similiar to start().
  • Subsequent calls return the result immediately from cache, without using a player.

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

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

Related Issues

Couldn't find any

@guneyozsan
Copy link
Author

These two required tests fail, but I'm not sure if they are relevant to this PR:
https://github.com/bluefireteam/audioplayers/actions/runs/18434296690/job/52525732461?pr=1954
https://github.com/bluefireteam/audioplayers/actions/runs/18434296690/job/52525732471?pr=1954

Run net start audiosrv
The requested service has already been started.

@Gustl22
Copy link
Collaborator

Gustl22 commented Nov 6, 2025

Thank you for contributung! I currently work on a refactor to make some tests work again. I will have a look at your PR as soon as its resolved :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants