You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which API doesn't behave as documented, and how does it misbehave?
I created my custom EventChannel to listen to event of unplugging headset to detect and stop in such situation music in my radio app. Event is working fine if it's called from main UI of application eg: state initialization of widget. But trying to use EventChannel inside scope of BackgroundAudioTask eg: onStart of task it throws error MissingPluginException
Problem is when user close app but leave Audio Manager open and playing music. Then on unplugg of headset won't stop music.
To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:
Run application on Android it should appear just after API end load of data.
Error messages
The following MissingPluginException was thrown while activating platform stream on channel com.radioanime24.dev/headphones:
MissingPluginException(No implementation found for method listen on channel com.radioanime24.dev/headphones)
Expected behavior
Working EventChannel inside scope of BackgroundAudioTask or if this is not possible leave information in documentation that using MethodChannel or EventChannel is not possible inside BackgroundAudioTask.
Screenshots
If applicable, add screenshots to help explain your problem.
Runtime Environment (please complete the following information if relevant):
Device: Emulator / Huawei P20
OS: 10
Flutter SDK version
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.20.0-7.0.pre, on Mac OS X 10.15.5 19F101, locale pl-PL)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.47.0)
[✓] Connected device (1 available)
• No issues found!
Additional context
I believe that this can be connected to this issue: #129
The text was updated successfully, but these errors were encountered:
I think this is more of a Flutter thing. You need to define your Kotlin code in a plugin rather than embed it into the main activity. Plugins get automatically registered in each registry. I suppose you can research the Java APIs and maybe figure out how to register your EventChannel listener in the right registry for the background audio task but I think it would be easier for you to put your code in a plugin and have it automatically registered.
Incidentally, the feature you are trying to implement yourself is already provided by audio_service. Why not override onAudioBecomingNoisy in the background audio task?
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with audio_service.
Which API doesn't behave as documented, and how does it misbehave?
I created my custom EventChannel to listen to event of unplugging headset to detect and stop in such situation music in my radio app. Event is working fine if it's called from main UI of application eg: state initialization of widget. But trying to use
EventChannel
inside scope ofBackgroundAudioTask
eg:onStart
of task it throws errorMissingPluginException
Minimal reproduction project
Situation when custom EventChannel is broken:
https://github.com/Mighty683/radio-anime-24-app/tree/Audio_service_bug_repro
https://github.com/Mighty683/radio-anime-24-app/commit/21f76ed876f2cac0b3212386c24be2562095c666
For comparison working solution:
https://github.com/Mighty683/radio-anime-24-app/tree/master
https://github.com/Mighty683/radio-anime-24-app/commit/1624a139bb7d2f0f19df32a032f4385ba1df334c
Problem is when user close app but leave Audio Manager open and playing music. Then on unplugg of headset won't stop music.
To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:
Run application on Android it should appear just after API end load of data.
Error messages
Expected behavior
Working
EventChannel
inside scope of BackgroundAudioTask or if this is not possible leave information in documentation that usingMethodChannel
orEventChannel
is not possible inside BackgroundAudioTask.Screenshots
If applicable, add screenshots to help explain your problem.
Runtime Environment (please complete the following information if relevant):
Flutter SDK version
Additional context
I believe that this can be connected to this issue:
#129
The text was updated successfully, but these errors were encountered: