Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with FlutterIsolate #188

Merged
merged 1 commit into from Feb 24, 2020
Merged

Fix bug with FlutterIsolate #188

merged 1 commit into from Feb 24, 2020

Conversation

siqwin
Copy link
Contributor

@siqwin siqwin commented Feb 21, 2020

It is necessary to kill a specific FlutterIsolate instance, otherwise, if there are other FlutterIsolate instances in the project, then all of them will be killed when disposing of audio_service.

@ryanheise ryanheise merged commit 5a89088 into ryanheise:master Feb 24, 2020
@ryanheise
Copy link
Owner

Thanks!

iamgoddog added a commit to iamgoddog/audio_service that referenced this pull request Apr 13, 2020
* master:
  Version 0.6.2
  Fix onAddQueueItemAt invokeMethod in AudioServicePlugin.java (ryanheise#192)
  Fix bug with FlutterIsolate (ryanheise#188)
  Account for playback speed in current position (ryanheise#184)
  Fix background seek on iOS. (ryanheise#172)
  Version 6.0.1
  Handle focus request failure more gracefully

# Conflicts:
#	android/src/main/java/com/ryanheise/audioservice/AudioServicePlugin.java
#	ios/Classes/AudioServicePlugin.m
#	lib/audio_service.dart
@ryanheise
Copy link
Owner

I'm not sure if this actually works. No memory is shared between isolates, so if you set the static global _flutterIsolate inside start (inside the main isolate), this should be null inside the background isolate, so this line would do nothing:

AudioService._flutterIsolate?.kill();

This change will be reverted in the next release, but if you re-encounter your issue, let's try to work out a solution to it.

It seems like FlutterIsolate.current should work because current does not refer to all isolates, it refers to the specific one that the background audio task is running it.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants