Fix stop player when switching to another
This commit is contained in:
parent
14958d9165
commit
885c0b1316
@ -441,7 +441,7 @@ class _MediaPlayerControlsState extends State<MediaPlayerControls> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _switchTo(entity) {
|
void _switchTo(entity) {
|
||||||
eventBus.fire(ServiceCallEvent(entity.domain, "turn_off", entity.entityId, null));
|
HomeAssistant().sendFromPlayerId = entity.enityId;
|
||||||
_duplicateTo(entity);
|
_duplicateTo(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ class HomeAssistant {
|
|||||||
HSVColor savedColor;
|
HSVColor savedColor;
|
||||||
int savedPlayerPosition;
|
int savedPlayerPosition;
|
||||||
String sendToPlayerId;
|
String sendToPlayerId;
|
||||||
|
String sendFromPlayerId;
|
||||||
|
|
||||||
String fcmToken;
|
String fcmToken;
|
||||||
|
|
||||||
|
@ -94,6 +94,10 @@ class _PlayMediaPageState extends State<PlayMediaPage> {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
HomeAssistant().sendToPlayerId = entity.entityId;
|
HomeAssistant().sendToPlayerId = entity.entityId;
|
||||||
|
if (HomeAssistant().sendFromPlayerId != null) {
|
||||||
|
eventBus.fire(ServiceCallEvent(HomeAssistant().sendFromPlayerId.split(".")[0], "turn_off", HomeAssistant().sendFromPlayerId, null));
|
||||||
|
HomeAssistant().sendFromPlayerId = null;
|
||||||
|
}
|
||||||
eventBus.fire(ShowEntityPageEvent(entity: entity));
|
eventBus.fire(ShowEntityPageEvent(entity: entity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user