Open nt4f04uNd opened 3 years ago
@ryanheise I'm working on improving AudioService life model, which should also fix https://github.com/ryanheise/audio_service/issues/671 and probably other issues related to notification being destroyed
Just wanted to let you know in case you were doing any native changes
I had a similar problem and my solution was to prevent the updateMediaItem
from happening when the player was stopped. In my case, I prevent updateMediaItem
when AudioProcessingState
is not in a ready state.
@override
Future<void> updateMediaItem(MediaItem newMediaItem) async {
if (playbackState.value.processingState == AudioProcessingState.ready) {
mediaItem.add(MediaItem(...));
}
}
Which API doesn't behave as documented, and how does it misbehave? Notification shouldn't be created when
mediaItem
is updated and service is stopped (stop
was called)Minimal reproduction project https://github.com/nt4f04unds-archive/issues/tree/audio_service_690
To Reproduce (i.e. user steps, not code)
Additionly, as you can see on the video below, updating media item without ever running service doesn't create notification
Error messages n/a
Expected behavior Notification to not reappear
Screenshots
https://user-images.githubusercontent.com/39104740/116822411-52062080-ab87-11eb-99eb-40a525eb7000.mp4
Runtime Environment (please complete the following information if relevant):
Flutter SDK version
flutter doctor -v
``` [✓] Flutter (Channel sweyer, 2.2.0-11.0.pre.158, on Microsoft Windows [Version 10.0.19041.928], locale ru-RU) • Flutter version 2.2.0-11.0.pre.158 at c:\dev\src\flutter • Upstream repository git@github.com:nt4f04und/flutter.git • Framework revision 1a5a05b7ae (2 weeks ago), 2021-04-06 05:14:02 +0800 • Engine revision e3832e14b4 • Dart version 2.14.0 (build 2.14.0-8.0.dev) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) • Android SDK at C:\Users\danya\AppData\Local\Android\sdk • Platform android-30, build-tools 30.0.2 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) • All Android licenses accepted. [✓] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.7) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.7.30621.155 • Windows 10 SDK version 10.0.19041.0 [✓] Android Studio (version 4.1.0) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) [✓] IntelliJ IDEA Community Edition (version 2020.3) • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.3 • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart [✓] VS Code (version 1.55.2) • VS Code at C:\Users\danya\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.21.0 [✓] Connected device (4 available) • Redmi Note 5 (mobile) • 40c9f14 • android-arm64 • Android 9 (API 28) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19041.928] • Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.128 • Edge (web) • edge • web-javascript • Microsoft Edge 89.0.774.77 • No issues found! ```Additional context No