mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 10:47:25 +01:00
mobile: Fix reconnection to playback service
This commit is contained in:
parent
437e6a3c2c
commit
7bf99ebd07
1 changed files with 32 additions and 28 deletions
|
|
@ -109,7 +109,10 @@ class Player {
|
|||
|
||||
/// Connect listeners and initialize streams.
|
||||
void setup() {
|
||||
if (_playbackServiceStateSubscription == null) {
|
||||
if (_playbackServiceStateSubscription != null) {
|
||||
_playbackServiceStateSubscription.cancel();
|
||||
}
|
||||
|
||||
// We will receive updated state information from the playback service,
|
||||
// which runs in its own isolate, through this port.
|
||||
final receivePort = ReceivePort();
|
||||
|
|
@ -136,8 +139,9 @@ class Player {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
IsolateNameServer.removePortNameMapping(_portName);
|
||||
IsolateNameServer.registerPortWithName(receivePort.sendPort, _portName);
|
||||
}
|
||||
|
||||
if (AudioService.running) {
|
||||
active.add(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue