Skip to content

Improves audio player functionality and configuration#2

Merged
RedC4ke merged 3 commits into
mainfrom
0.2.0-beta.3
Feb 16, 2026
Merged

Improves audio player functionality and configuration#2
RedC4ke merged 3 commits into
mainfrom
0.2.0-beta.3

Conversation

@RedC4ke

@RedC4ke RedC4ke commented Feb 16, 2026

Copy link
Copy Markdown
Collaborator

Updates the audio player to improve functionality and configuration options.

  • Forwards the rewind/fast-forward interval configuration to the system media controls, ensuring the configured values are used instead of the defaults.
  • Simplifies the internal playback state stream by adding .distinct() to prevent redundant emissions, optimizing performance.

Ensures the configured rewind and fast-forward intervals are correctly used by system media controls.

Simplifies the internal playback state stream and prevents redundant emissions for improved efficiency.
@RedC4ke RedC4ke self-assigned this Feb 16, 2026
@RedC4ke RedC4ke added the enhancement New feature or request label Feb 16, 2026
@RedC4ke RedC4ke requested a review from Copilot February 16, 2026 13:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the mt_audio public API and internal streaming to improve playback control behavior and reduce redundant state emissions, while updating docs/examples to match the new API.

Changes:

  • Forward ffRewindInterval into AudioServiceConfig so system media controls use the configured seek interval.
  • Replace MtAudioSource (and setSource) with explicit setAudioItem / setPlaylist APIs across library + examples/docs.
  • Simplify playback state stream wiring and apply .distinct() to reduce redundant emissions.

Reviewed changes

Copilot reviewed 14 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pubspec.lock Updates transitive dependency lockfile entries.
lib/src/player/mt_audio_player.dart Forwards seek intervals into AudioServiceConfig; simplifies playback state stream and adds setAudioItem/setPlaylist.
lib/src/models/mt_audio_source.dart Removes the sealed MtAudioSource model hierarchy (breaking change).
lib/src/handler/mt_audio_handler.dart Adds setItem/setPlaylist; forwards player errors into errorStream; renames Android Auto delegate field.
lib/src/carplay/mt_carplay_delegate.dart Updates documentation snippet to new setAudioItem API.
lib/src/android_auto/mt_android_auto_delegate.dart Updates documentation snippet to new setAudioItem API.
lib/mt_audio.dart Stops exporting removed mt_audio_source.dart.
example/pubspec.lock Updates example lockfile (path package version + transitive lock).
example/lib/providers/example_carplay_delegate.dart Migrates example delegate to setAudioItem / setPlaylist.
example/lib/providers/example_android_auto_delegate.dart Migrates example delegate to setAudioItem.
example/lib/pages/queue_page.dart Migrates example UI to setPlaylist.
example/lib/pages/home_page.dart Migrates example UI to new source-loading methods and renames helper.
README.md Updates package positioning + usage examples to new API and new install version text.
CLAUDE.md Updates internal module notes to reflect the new two-method source API.
CHANGELOG.md Adds a 0.2.0-beta.3 entry describing the breaking changes and fixes.
.github/workflows/publish.yml Expands tag trigger patterns to include prerelease-style tags.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment on lines 52 to +54
```yaml
dependencies:
mt_audio: ^0.2.0-beta.1
mt_audio: ^0.2.0-beta.3

Copilot AI Feb 16, 2026

Copy link

Choose a reason for hiding this comment

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

README now instructs installing mt_audio: ^0.2.0-beta.3, but pubspec.yaml in this repo still declares version: 0.2.0-beta.2. Either bump the package version (and regenerate locks) or keep the README version aligned with the actual package version to avoid publishing/install confusion.

Copilot uses AI. Check for mistakes.
Comment thread CHANGELOG.md
Comment on lines +1 to +6
## 0.2.0-beta.3 - 2026-02-16

### Changed

- Replaced `MtAudioSource` sealed class (`MtSingleSource`, `MtPlaylistSource`, `MtLiveSource`) with two explicit methods on `MtAudioPlayer`: `setAudioItem(MtAudioItem)` and `setPlaylist(List<MtAudioItem>, {int initialIndex})`.
- Simplified internal playback state stream and added `.distinct()` to prevent redundant emissions.

Copilot AI Feb 16, 2026

Copy link

Choose a reason for hiding this comment

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

CHANGELOG introduces a 0.2.0-beta.3 entry, but the package pubspec.yaml still declares version: 0.2.0-beta.2. Please align the changelog entry with the actual package version being released (or bump pubspec.yaml accordingly) so tags/publishing and user expectations match.

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/publish.yml Outdated
Comment on lines +6 to +7
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-**"

Copilot AI Feb 16, 2026

Copy link

Choose a reason for hiding this comment

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

The tag filters here use GitHub Actions glob patterns (not regex). Patterns like "v[0-9]+.[0-9]+.[0-9]+-" treat '+' as a literal character and are unlikely to match normal semver tags (and '' is unnecessary). Consider switching to glob-appropriate patterns (e.g., v[0-9].[0-9].[0-9]- or v*..-*), and likewise updating the non-suffixed tag pattern for consistency.

Suggested change
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-**"
- "v[0-9]*.[0-9]*.[0-9]*"
- "v[0-9]*.[0-9]*.[0-9]*-*"

Copilot uses AI. Check for mistakes.
Comment on lines +74 to +83
// Forward playback errors to error subject
_player.errorStream.listen((error) {
_errorSubject.add(
MtAudioError(
code: MtAudioErrorCode.unknown,
message: error.message ?? 'Playback error',
details: error.toString(),
),
);
});

Copilot AI Feb 16, 2026

Copy link

Choose a reason for hiding this comment

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

This new _player.errorStream.listen(...) subscription isn’t stored/cancelled, and dispose() closes _errorSubject before calling _player.dispose(). That creates a race where an error event can arrive during disposal (or before _player.dispose() runs) and attempt _errorSubject.add(...) after the subject is closed, throwing a bad state error. Store the subscription and cancel it in dispose(), or reorder disposal so the player is disposed (or listeners cancelled) before closing the subjects.

Copilot uses AI. Check for mistakes.
Updates the pubspec version to 0.2.0-beta.3 and adjusts the tag matching regular expression in the publish workflow to allow for multi-digit version numbers.
@RedC4ke RedC4ke merged commit bb2b84c into main Feb 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants