Fetch latest updates#1
Open
Ahmedrali wants to merge 321 commits into
Open
Conversation
- audioplayers@1.1.0 - audioplayers_android@1.1.0 - audioplayers_darwin@1.0.2 - audioplayers_linux@1.0.1 - audioplayers_platform_interface@2.0.0 - audioplayers_web@2.0.0 - audioplayers_windows@1.1.0
* chore(tests): only execute tests, if is no draft * fix ios simulator UDID * consistent naming * chore(tests): also run tests on ready_for_review Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
* fix(web): handle infinite value on getDuration * feat: improve web code * feat: improve web code docs * fix(web): currentTime
I decided to do a separate PR, as it doesn't really belong to the tests in #1284. Avoid getting error when calling getDuration on darwin, when getting back infinity or NaN values.
* test: player state tests (#1257) * test: more reliable duration checks * test: test for duration on live stream * test: improve durationRangeMatcher * test(example): allow cleartext traffic / AllowsArbitraryLoads on darwin * test: test onPosition on every platform * tests: overwrite setState for streams tab * fix(linux): install gstreamer1.0-plugins-bad for m3u8 tests * test(windows): disable playlist source (m3u8) on windows
- audioplayers@1.1.1 - audioplayers_android@1.1.1 - audioplayers_darwin@1.0.3 - audioplayers_web@2.0.1
* fix: Duration precision on Windows * fix: duration display on windows, when duration is unknown/infinity
* test: more reliable tests for live streams * chore(workflow): run apt-get install non-interactively * chore(workflow): install libunwind-dev on linux to work on GH runner image Ubuntu 22.04 * test: waitOneshot, wait for stop event * test: wait for stop event in streams * tests: simplify resume * test: update release modes for platforms * flutter format
The cache was not being cleared properly since it wasn't the correct type for the key passed in to clear and it was mapping values instead of keys in clearAll.
* Fix repos and homepages on pubspecs * Fix build status link on REAMDE
* feat: set source and get source * feat: button to get source * fix: scrollToAndTap * feat: scroll to and tap * increase timeout * add test for #setSource
* feat: local test server * fix: disable web security for web workflow
* ability to trigger each job individually via workflow_dispatch * categorize reusable workflows / jobs into `build` and `test` * split trigger into `pull-request` and `release`
* chore(workflows): use build.yml as default for main push trigger, refactor build to build-example * docs: revert formatting
* test: disable simultaneously tests for Android
…#1363) There has been a high number of issues being opened around the fact that on 1.0.0, forceSpeaker on iOS (and android) was set to false by default, requiring most users to explicitly setup the global audio context. This change the default value of iOS audio context to force speakers to be inline with what users seem to expect. Follow this thread for details. Since I only test iOS on emulators, where this setting doesn't make any difference, I hadn't realized this issue. Note: this changes the default for android as well, which is in line with the unified audio context philosophy. Migration instructions If you wanted to have it set to false, you can just set it so: final AudioContext audioContext = AudioContext( iOS: AudioContextIOS( defaultToSpeaker: false, // ... ), // ... ); AudioPlayer.global.setGlobalAudioContext(audioContext); If not, you can remove all the ad-hoc code you had to set this up.
- audioplayers@1.2.0 - audioplayers_android@1.1.3 - audioplayers_darwin@1.0.4 - audioplayers_linux@1.0.2 - audioplayers_platform_interface@2.1.0 - audioplayers_web@2.1.0 - audioplayers_windows@1.1.1 Co-authored-by: Lukas Klingsbo <SEFUNCTeamRatatosk@skandia.se>
…ce with `AVAudioSessionOptions.defaultToSpeaker` (#1374) The parameter defaultToSpeaker was not used in AudioContextIOS. Instead option: [AVAudioSessionOptions.defaultToSpeaker] should be used AudioContext now has default configurations for iOS and android. Nevertheless it is recommended to set the config via AudioContextConfig.build().
- audioplayers@2.0.0 - audioplayers_darwin@2.0.0 - audioplayers_platform_interface@3.0.0 - audioplayers_android@1.1.4 - audioplayers_windows@1.1.2 - audioplayers_linux@1.0.3 - audioplayers_web@2.1.1
This fixes some 404s for links to other documentation. Relative links in pub.dev would lead to 404s in github. On the documentation page of pub.dev it would lead to 404s on pub.dev Instead the links have been changed to link directly to https://github.com/bluefireteam/audioplayers/blob/main.
…itialization error (#1964) Further: - adapt tests - upgrade ci runners - upgrade min platform dependency versions
# Description We at Elredo sometime run into weird issues regarding audio playing using this library. So I started to investigate and I found out that there might be few memory leaks in the library.
…ed (#1922) # Description When an android device is low on storage, it can happen that the OS clears the cache of the app. In that case we get a FileNotFoundException when running an audio file for the 2nd time.
# Description
Same one we have on other repos. I noticed it was missing on
audioplayers.
## Checklist
- [x] The title of my PR starts with a [Conventional Commit] prefix
(`fix:`, `feat:`, `refactor:`,
`docs:`, `chore:`, `test:`, `ci:` etc).
- [x] I have read the [Contributor Guide] and followed the process
outlined for submitting PRs.
- [x] I have updated/added tests for ALL new/updated/fixed
functionality.
- [x] I have updated/added relevant documentation and added dartdoc
comments with `///`, where necessary.
- [x] I have updated/added relevant examples in [example].
## Breaking Change
- [ ] Yes, this is a breaking change.
- [x] No, this is *not* a breaking change.
<!-- Links -->
[issue database]: https://github.com/bluefireteam/audioplayers/issues
[Contributor Guide]:
https://github.com/bluefireteam/audioplayers/blob/main/contributing.md#feature-requests--prs
[Conventional Commit]: https://conventionalcommits.org
[example]:
https://github.com/bluefireteam/audioplayers/tree/main/packages/audioplayers/example
# Description Fix audio playback on Safari (web) by reusing a single `AudioContext` per player instance and explicitly resuming it before playback. Closes #1759 **Existing behavior:** `recreateNode()` created a new `web.AudioContext()` on every call and stored it only as a local variable. This caused three problems: 1. Safari starts new AudioContexts in `suspended` state and requires an explicit `resume()` within a user gesture — this call was missing entirely, so audio never played. 2. The AudioContext reference was lost after `recreateNode()` returned, making it impossible to resume or close later. 3. Old AudioContexts were never closed, leaking resources. Safari enforces a limit of ~4–6 AudioContexts per page, so after a few play/release cycles the limit was exhausted and no new context could be created. Chrome auto-resumes AudioContexts, which is why the issue only manifested on Safari. **Changes:** - Store `AudioContext` and `MediaElementAudioSourceNode` as class-level fields on `WrappedPlayer`. - Reuse the existing `AudioContext` across `recreateNode()` calls (`_audioContext ??= web.AudioContext()`). - Call `audioContext.resume()` in `start()` when the context is suspended (required by Safari). - Disconnect `_sourceNode` in `release()` for proper cleanup without closing the shared context. - Close and null the `AudioContext` in `dispose()` to prevent resource leaks.
# Description If playing multiple sources one after one in the same player, the sources sometimes would not play in `release` mode. ```dart final player = AudioPlayer(); String audioUrl1 = "https://cdn.pixabay.com/audio/2021/08/04/audio_12b0c7443c.mp3"; print("play 1"); await player.play(UrlSource(audioUrl1)); await Future.delayed(const Duration(seconds: 3)); await player.stop(); print("play 2"); await player.play(UrlSource(audioUrl1)); await Future.delayed(const Duration(seconds: 3)); await player.stop(); print("play 3"); await player.play(UrlSource(audioUrl1)); await Future.delayed(const Duration(seconds: 3)); await player.stop(); ``` The `pausedAt` property is now reset, when calling `release` which allows playing the next source at 0.
Just bumps Melos to a stable version now when the min version the Dart SDK used with audioplayers is ^3.9.0.
Prepared all packages to be released to pub.dev Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
# Description The caching issue that was fixed on Android also exists on iOS. This PR removes the platform check so that the file existence is validated on all platforms. --------- Co-authored-by: August <git@reb0.org>
…#1978) # Description When an `HTMLAudioElement` is connected to the Web Audio API via `createMediaElementSource()`, Safari ignores the `HTMLMediaElement.volume` property — the audio is routed through the Web Audio API graph and Safari expects volume to be controlled within that graph. Previously, volume was set directly on the `HTMLAudioElement.volume` property, which only worked on Chrome (Chrome honors `element.volume` even after connecting to Web Audio API). This PR replaces `HTMLAudioElement.volume` with a `GainNode` inserted into the Web Audio API processing chain: **Before:** `MediaElementSource → StereoPanner → Destination` (volume via `element.volume`) **After:** `MediaElementSource → GainNode → StereoPanner → Destination` (volume via `gainNode.gain.value`) This is the [standard pattern recommended by MDN](https://github.com/mdn/webaudio-examples/blob/main/audio-basics/index.html) for controlling volume in Web Audio API. **How to reproduce:** 1. Open https://bluefireteam.github.io/audioplayers/ in Safari 2. Play any sound 3. Change the volume — nothing happens, volume stays the same 4. Open the same page in Chrome — volume control works correctly **Why `GainNode` is the correct fix:** - [MDN: GainNode — supported in all browsers](https://developer.mozilla.org/en-US/docs/Web/API/GainNode)
# 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. --------- Co-authored-by: Gustl22 <git@reb0.org>
fix(windows): support multi-engine and fix crashes in multi-window environments # Description Previously, `AudioplayersWindowsPlugin` utilized `static inline` global variables for the `MethodChannel` and `EventStreamHandler`. In multi-window scenarios (e.g., using `desktop_multi_window`), where multiple Flutter Engines are initialized, these static pointers were overwritten by the most recently opened window. This caused the plugin state of previous windows to become corrupted, leading to crashes and inconsistent behavior. This PR refactors the plugin to move these globals into instance members. This ensures: - Each Engine instance maintains its own independent `MethodChannel` and `EventStreamHandler`. - Plugin states are completely isolated across different windows. - Memory safety is improved by preventing the overwriting of global static pointers. --------- Co-authored-by: idcpj <idcpj@qq.com>
…1987) # Description Fixes #1986. `ExoPlayerWrapper.setVolume` currently registers only a stereo `ChannelMixingMatrix(2, 2, ...)` on the underlying `AdaptiveChannelMixingAudioProcessor`. The processor's `queueInput` looks up the matrix by the *source's* `inputAudioFormat.channelCount` — so for **mono inputs** (`channelCount = 1`) the lookup returns `null`, the processor short-circuits to a passthrough, and `setVolume` becomes a silent no-op. This regresses any app that uses `audioplayers_android_exo` in place of `audioplayers_android` and plays single-channel content (voiceovers, podcasts, meditation tracks, TTS output, low-bitrate streams, etc.). The bug is hard to notice in testing because most test audio happens to be stereo, where the existing code path works correctly. ## What this PR changes - In `ExoPlayerWrapper.setVolume`, register a second `ChannelMixingMatrix(1, 1, ...)` alongside the existing stereo one, so the lookup also succeeds for `channelCount = 1` sources. - The mono matrix uses the **average** of `leftVolume` and `rightVolume`, since balance has no meaning for single-channel input. Callers that pass equal left/right values (the overwhelming majority — including the `AudioPlayer.setVolume(double)` public API which calls `setVolume(volume, volume)` under the hood) get exactly that level applied. Callers that pass differing values get a sensible perceived level instead of being silently ignored. - Stereo behaviour is unchanged. ## Code change ```kotlin @androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class) override fun setVolume(leftVolume: Float, rightVolume: Float) { // AdaptiveChannelMixingAudioProcessor looks up the matrix by the // *source's* channel count at queueInput time. Register an entry for // both mono (channelCount = 1) and stereo (channelCount = 2) inputs, // otherwise mono sources fall through `matrixByInputChannelCount[1] == null` // and play back at full volume regardless of the requested level. this.channelMixingAudioProcessor.putChannelMixingMatrix( ChannelMixingMatrix(2, 2, floatArrayOf(leftVolume, 0f, 0f, rightVolume)), ) // For mono input, balance has no meaning — average left/right into a // single scalar so callers that pass differing left/right volumes // still produce a sensible perceived level. val monoVolume = (leftVolume + rightVolume) / 2f this.channelMixingAudioProcessor.putChannelMixingMatrix( ChannelMixingMatrix(1, 1, floatArrayOf(monoVolume)), ) } ``` ## Manual verification Reproduced and validated on a real device (OnePlus 6T, Android 11, audioplayers 6.6.0, audioplayers_android_exo 0.1.3): - Mono MP3 source + `player.setVolume(0.0)` → **before:** still full volume; **after:** muted - Mono MP3 source + `player.setVolume(0.5)` → **before:** still full volume; **after:** half volume - Stereo MP3 source + `player.setVolume(0.5)` → unchanged in both (works correctly) - No regression on `setBalance` for stereo sources
# Description Pipeline is currently timing out on GH with Image Macos 15.7.7. As we also provide tests for Macos 14, we should temporarly disable the tests until a solution for flutter/flutter#176850 is provided. See example run: https://github.com/bluefireteam/audioplayers/actions/runs/26475948464/job/77961428758 ## Checklist <!-- Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (`[x]`). This will ensure a smooth and quick review process. --> - [x] The title of my PR starts with a [Conventional Commit] prefix (`fix:`, `feat:`, `refactor:`, `docs:`, `chore:`, `test:`, `ci:` etc). - [x] 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. - [x] I have updated/added relevant documentation and added dartdoc comments with `///`, where necessary. - [x] I have updated/added relevant examples in [example]. ## Breaking Change <!-- Does your PR require audioplayers users to manually update their apps to accommodate your 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. - [x] No, this is *not* a breaking change. <!-- If the PR is breaking, uncomment the following section and add instructions for how to migrate from the currently released version to the new proposed way. --> <!-- ### Migration instructions Before: ``` ``` After: ``` ``` --> ## Related Issues See: flutter/flutter#176850 <!-- Links --> [issue database]: https://github.com/bluefireteam/audioplayers/issues [Contributor Guide]: https://github.com/bluefireteam/audioplayers/blob/main/contributing.md#feature-requests--prs [Conventional Commit]: https://conventionalcommits.org [example]: https://github.com/bluefireteam/audioplayers/tree/main/packages/audioplayers/example
Prepared all packages to be released to pub.dev --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Gustl22 <18537755+Gustl22@users.noreply.github.com>
# Description Closes #1980 (comment)
Prepared all packages to be released to pub.dev Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
# Description Before this change, one had to hand over many environment variables, in order to get the tests pass locally. This change reduces this need, so most of the tests will work out of the box. Remove / replace environment flags for: - TEST_FEATURE_BYTES_SOURCE: Min SDK of Flutter is 24, so it has no relevance in min tests any more - TEST_FEATURE_PLAYBACK_RATE: Min SDK of Flutter is 24, so it has no relevance in min tests any more - TEST_FEATURE_LOW_LATENCY: Replaced by `usesAndroidMediaPlayerImpl` - TEST_ANDROID_MEDIAPLAYER: Replaced by `usesAndroidMediaPlayerImpl` by checking the used dependencies
# Description Presumably fixes #flutter/flutter#176850 See also: #1989
# Description - Update example windows platform folder - Update to CXX compiler version 23 - Fix subsequent compilation errors - Update WIL version
# Description It seems that the plugin registration for path proivder is added on a macos host, but removed on other hosts. So the automated output is not the same on each platform. Needs to be fixed in order to be able to release. See #1997
Prepared all packages to be released to pub.dev Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
# Description In #2004 I fixed the Visual Studio 18 compatibility. But there is one optimization one can do by adding the required cxx_std_20 lib to the CMakeLists.txt of the package, so no manual add in the project CMakeLists.txt is required (at least not this part). But still one needs to raise the cmake_minimum_required version. ## Checklist <!-- Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (`[x]`). This will ensure a smooth and quick review process. --> - [x] The title of my PR starts with a [Conventional Commit] prefix (`fix:`, `feat:`, `refactor:`, `docs:`, `chore:`, `test:`, `ci:` etc). - [x] I have read the [Contributor Guide] and followed the process outlined for submitting PRs. - [x] I have updated/added tests for ALL new/updated/fixed functionality. - [x] I have updated/added relevant documentation and added dartdoc comments with `///`, where necessary. - [x] I have updated/added relevant examples in [example]. ## Breaking Change - [ ] Yes, this is a breaking change. - [x] No, this is *not* a breaking change. ## Related Issues flutter/flutter#185597 (comment) #1985 <!-- Links --> [issue database]: https://github.com/bluefireteam/audioplayers/issues [Contributor Guide]: https://github.com/bluefireteam/audioplayers/blob/main/contributing.md#feature-requests--prs [Conventional Commit]: https://conventionalcommits.org [example]: https://github.com/bluefireteam/audioplayers/tree/main/packages/audioplayers/example
) # Description The event stream can be closed before it gets prepared. In that case, a StateError is thrown. Error represents a program failure that the programmer should have avoided. Switch to an Exception with a clear message instead. ## Checklist - [x] The title of my PR starts with a [Conventional Commit] prefix (`fix:`, `feat:`, `refactor:`, `docs:`, `chore:`, `test:`, `ci:` etc). - [x] I have read the [Contributor Guide] and followed the process outlined for submitting PRs. - [x] I have updated/added tests for ALL new/updated/fixed functionality. - [x] I have updated/added relevant documentation and added dartdoc comments with `///`, where necessary. - [x] I have updated/added relevant examples in [example]. ## Breaking Change <!-- Does your PR require audioplayers users to manually update their apps to accommodate your 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. - [x] No, this is *not* a breaking change. <!-- If the PR is breaking, uncomment the following section and add instructions for how to migrate from the currently released version to the new proposed way. --> ## Related Issues Fixes #2005 <!-- Links --> [issue database]: https://github.com/bluefireteam/audioplayers/issues [Contributor Guide]: https://github.com/bluefireteam/audioplayers/blob/main/contributing.md#feature-requests--prs [Conventional Commit]: https://conventionalcommits.org [example]: https://github.com/bluefireteam/audioplayers/tree/main/packages/audioplayers/example
Prepared all packages to be released to pub.dev --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Gustl22 <git@reb0.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.