Feat : STRCHA Stream status

This commit is contained in:
jeanotx32
2026-08-11 00:52:33 +02:00
parent 6f11b72cbb
commit b529417940
13 changed files with 1038 additions and 14 deletions

View File

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