mobile: Fix reconnection to playback service

This commit is contained in:
Elias Projahn 2020-05-03 22:45:28 +02:00
parent 437e6a3c2c
commit 7bf99ebd07

View file

@ -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);