mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-12 02:29:59 +00:00
Improve receiver status handling
This commit is contained in:
@@ -1,22 +1,23 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
export interface ReceiverStatus {
|
export interface ReceiverStatus {
|
||||||
volume: {
|
applications?: Array<{
|
||||||
muted: boolean;
|
appId: string
|
||||||
stepInterval: number;
|
, appType: string
|
||||||
controlType: string;
|
, displayName: string
|
||||||
level: number;
|
, iconUrl: string
|
||||||
};
|
, isIdleScreen: boolean
|
||||||
applications?: Array<{
|
, launchedFromCloud: boolean
|
||||||
displayName: string;
|
, namespaces: Array<{ name: string }>
|
||||||
statusText: string;
|
, sessionId: string
|
||||||
transportId: string;
|
, statusText: string
|
||||||
isIdleScreen: boolean;
|
, transportId: string
|
||||||
sessionId: string;
|
, universalAppId: string
|
||||||
namespaces: Array<{ name: string }>;
|
}>
|
||||||
appId: string;
|
, isActiveInput: boolean
|
||||||
}>;
|
, isStandBy: boolean
|
||||||
userEq?: {};
|
, userEq: unknown
|
||||||
|
, volume: Volume
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MediaStatus {
|
export interface MediaStatus {
|
||||||
@@ -84,3 +85,20 @@ export interface Receiver {
|
|||||||
port: number;
|
port: number;
|
||||||
status?: ReceiverStatus;
|
status?: ReceiverStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export enum VolumeControlType {
|
||||||
|
ATTENUATION = "attenuation"
|
||||||
|
, FIXED = "fixed"
|
||||||
|
, MASTER = "master"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export class Volume {
|
||||||
|
public controlType?: VolumeControlType;
|
||||||
|
public stepInterval?: number;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
public level: (number | null) = null
|
||||||
|
, public muted: (boolean | null) = null) {}
|
||||||
|
}
|
||||||
|
|||||||
@@ -80,21 +80,19 @@ export default class Session {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "shim:session/updateStatus": {
|
case "shim:session/updateStatus": {
|
||||||
const volume: Volume = message.data.volume;
|
const status = message.data;
|
||||||
|
|
||||||
if (volume) {
|
if (status.volume) {
|
||||||
if (!this.receiver.volume) {
|
if (!this.receiver.volume) {
|
||||||
const receiverVolume = new Volume(
|
const receiverVolume = new Volume(
|
||||||
volume.level
|
status.volume.level, status.volume.muted);
|
||||||
, volume.muted);
|
|
||||||
|
|
||||||
receiverVolume.controlType = volume.controlType;
|
receiverVolume.controlType = status.volume.controlType;
|
||||||
receiverVolume.stepInterval = volume.stepInterval;
|
receiverVolume.stepInterval =
|
||||||
|
status.volume.stepInterval;
|
||||||
this.receiver.volume = receiverVolume;
|
|
||||||
} else {
|
} else {
|
||||||
this.receiver.volume.level = volume.level;
|
this.receiver.volume.level = status.volume.level;
|
||||||
this.receiver.volume.muted = volume.muted;
|
this.receiver.volume.muted = status.volume.muted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,32 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
import { Volume } from "./shim/cast/dataClasses";
|
||||||
|
|
||||||
|
|
||||||
export interface Receiver {
|
export interface Receiver {
|
||||||
host: string;
|
host: string
|
||||||
friendlyName: string;
|
friendlyName: string
|
||||||
id: string;
|
, id: string
|
||||||
port: number;
|
, port: number
|
||||||
status?: ReceiverStatus;
|
, status?: ReceiverStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ReceiverStatus {
|
export interface ReceiverStatus {
|
||||||
application: {
|
applications?: Array<{
|
||||||
displayName: string;
|
appId: string
|
||||||
isIdleScreen: boolean;
|
, appType: string
|
||||||
statusText: string;
|
, displayName: string
|
||||||
};
|
, iconUrl: string
|
||||||
volume: {
|
, isIdleScreen: boolean
|
||||||
level: number;
|
, launchedFromCloud: boolean
|
||||||
muted: boolean
|
, namespaces: Array<{ name: string }>
|
||||||
};
|
, sessionId: string
|
||||||
|
, statusText: string
|
||||||
|
, transportId: string
|
||||||
|
, universalAppId: string
|
||||||
|
}>
|
||||||
|
, isActiveInput: boolean
|
||||||
|
, isStandBy: boolean
|
||||||
|
, userEq: unknown
|
||||||
|
, volume: Volume
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user