mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
eventhandler: Add ScreenshotSaved
event
No, this does not trigger with `Get/SaveScreenshot`. I've tried to make that super clear in the docs. Hopefully people don't get too confused.
This commit is contained in:
parent
9cfca3c7d1
commit
8cabe24b77
@ -353,12 +353,6 @@ void EventHandler::OnFrontendEvent(enum obs_frontend_event event, void *private_
|
||||
blog_debug("[EventHandler::OnFrontendEvent] Finished.");
|
||||
|
||||
break;
|
||||
case OBS_FRONTEND_EVENT_STUDIO_MODE_ENABLED:
|
||||
eventHandler->HandleStudioModeStateChanged(true);
|
||||
break;
|
||||
case OBS_FRONTEND_EVENT_STUDIO_MODE_DISABLED:
|
||||
eventHandler->HandleStudioModeStateChanged(false);
|
||||
break;
|
||||
|
||||
// Config
|
||||
case OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING: {
|
||||
@ -477,6 +471,17 @@ void EventHandler::OnFrontendEvent(enum obs_frontend_event event, void *private_
|
||||
eventHandler->HandleReplayBufferSaved();
|
||||
break;
|
||||
|
||||
// Ui
|
||||
case OBS_FRONTEND_EVENT_STUDIO_MODE_ENABLED:
|
||||
eventHandler->HandleStudioModeStateChanged(true);
|
||||
break;
|
||||
case OBS_FRONTEND_EVENT_STUDIO_MODE_DISABLED:
|
||||
eventHandler->HandleStudioModeStateChanged(false);
|
||||
break;
|
||||
case OBS_FRONTEND_EVENT_SCREENSHOT_TAKEN:
|
||||
eventHandler->HandleScreenshotSaved();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -78,7 +78,6 @@ private:
|
||||
|
||||
// General
|
||||
void HandleExitStarted();
|
||||
void HandleStudioModeStateChanged(bool enabled);
|
||||
|
||||
// Config
|
||||
void HandleCurrentSceneCollectionChanging();
|
||||
@ -170,4 +169,8 @@ private:
|
||||
static void HandleMediaInputPlaybackEnded(void *param,
|
||||
calldata_t *data); // Direct callback
|
||||
void HandleMediaInputActionTriggered(obs_source_t *source, ObsMediaInputAction action);
|
||||
|
||||
// Ui
|
||||
void HandleStudioModeStateChanged(bool enabled);
|
||||
void HandleScreenshotSaved();
|
||||
};
|
||||
|
@ -38,3 +38,27 @@ void EventHandler::HandleStudioModeStateChanged(bool enabled)
|
||||
eventData["studioModeEnabled"] = enabled;
|
||||
BroadcastEvent(EventSubscription::Ui, "StudioModeStateChanged", eventData);
|
||||
}
|
||||
|
||||
/**
|
||||
* A screenshot has been saved.
|
||||
*
|
||||
* Note: Triggered for the screenshot feature available in `Settings -> Hotkeys -> Screenshot Output` ONLY.
|
||||
* Applications using `Get/SaveSourceScreenshot` should implement a `CustomEvent` if this kind of inter-client
|
||||
* communication is desired.
|
||||
*
|
||||
* @dataField savedScreenshotPath | String | Path of the saved image file
|
||||
*
|
||||
* @eventType ScreenshotSaved
|
||||
* @eventSubscription Ui
|
||||
* @complexity 2
|
||||
* @rpcVersion -1
|
||||
* @initialVersion 5.1.0
|
||||
* @api events
|
||||
* @category ui
|
||||
*/
|
||||
void EventHandler::HandleScreenshotSaved()
|
||||
{
|
||||
json eventData;
|
||||
eventData["savedScreenshotPath"] = Utils::Obs::StringHelper::GetLastScreenshotFileName();
|
||||
BroadcastEvent(EventSubscription::Ui, "ScreenshotSaved", eventData);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user