mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-11 10:09:59 +00:00
Improve handling of receiver actions
This commit is contained in:
@@ -316,26 +316,6 @@ export default class {
|
||||
break;
|
||||
}
|
||||
|
||||
case "cast:selectReceiver/stopped": {
|
||||
const { receiverDevice } = message.data;
|
||||
|
||||
logger.info("Stopped receiver");
|
||||
|
||||
if (this.#sessionRequest) {
|
||||
this.#sessionRequest = undefined;
|
||||
|
||||
for (const listener of this.#receiverActionListeners) {
|
||||
listener(
|
||||
// TODO: Use existing receiver object?
|
||||
createReceiver(receiverDevice),
|
||||
ReceiverAction.STOP
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Popup closed before session established
|
||||
case "cast:selectReceiver/cancelled": {
|
||||
if (this.#sessionRequest) {
|
||||
@@ -349,6 +329,17 @@ export default class {
|
||||
break;
|
||||
}
|
||||
|
||||
case "cast:receiverStoppedAction": {
|
||||
const device = this.#receiverDevices.get(message.data.deviceId);
|
||||
if (!device) break;
|
||||
|
||||
for (const actionListener of this.#receiverActionListeners) {
|
||||
actionListener(createReceiver(device), ReceiverAction.STOP);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Session request initiated via receiver selector
|
||||
case "cast:launchApp": {
|
||||
if (this.#sessionRequest) {
|
||||
|
||||
@@ -92,7 +92,7 @@ interface ReqBase {
|
||||
// NS: urn:x-cast:com.google.cast.receiver
|
||||
export type SenderMessage =
|
||||
| (ReqBase & { type: "LAUNCH"; appId: string })
|
||||
| (ReqBase & { type: "STOP"; sessionId: string })
|
||||
| (ReqBase & { type: "STOP"; sessionId?: string })
|
||||
| (ReqBase & { type: "GET_STATUS" })
|
||||
| (ReqBase & { type: "GET_APP_AVAILABILITY"; appId: string[] })
|
||||
| (ReqBase & { type: "SET_VOLUME"; volume: Partial<Volume> });
|
||||
|
||||
Reference in New Issue
Block a user