Feat : STRCHA Stream status
This commit is contained in:
@@ -2,6 +2,12 @@ import { EventEmitter } from 'node:events';
|
||||
import OBSWebSocket from 'obs-websocket-js';
|
||||
import type { AgentAction, AgentStatus, ObsSettings } from '@stream-control/shared';
|
||||
|
||||
/**
|
||||
* Actions relevant d'OBS. `watch.*` et `hotkey.*` sont traitées en amont par
|
||||
* l'agent : elles ne concernent pas la session obs-websocket.
|
||||
*/
|
||||
export type ObsAction = Exclude<AgentAction, 'watch.check' | 'hotkey.fullscreen'>;
|
||||
|
||||
type ObsSnapshot = Pick<
|
||||
AgentStatus,
|
||||
| 'obsConnected'
|
||||
@@ -149,9 +155,16 @@ export class ObsController extends EventEmitter {
|
||||
this.reconnectTimer = null;
|
||||
}
|
||||
|
||||
/** État d'enregistrement à la demande, sans passer par l'instantané complet. */
|
||||
async recordState(): Promise<{ active: boolean; paused: boolean }> {
|
||||
if (!this.connected) return { active: false, paused: false };
|
||||
const status = await this.obs.call('GetRecordStatus');
|
||||
return { active: status.outputActive, paused: status.outputPaused };
|
||||
}
|
||||
|
||||
// --- Exécution des actions du protocole ---------------------------------
|
||||
|
||||
async execute(action: AgentAction, params: Record<string, unknown> = {}): Promise<unknown> {
|
||||
async execute(action: ObsAction, params: Record<string, unknown> = {}): Promise<unknown> {
|
||||
switch (action) {
|
||||
case 'obs.connect':
|
||||
await this.connect();
|
||||
|
||||
Reference in New Issue
Block a user