Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling frontend JS events #429

Merged
merged 2 commits into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions obs-browser-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,55 +549,55 @@ static void handle_obs_frontend_event(enum obs_frontend_event event, void *)
{
switch (event) {
case OBS_FRONTEND_EVENT_STREAMING_STARTING:
DispatchJSEvent("obsStreamingStarting", "");
DispatchJSEvent("obsStreamingStarting", "null");
break;
case OBS_FRONTEND_EVENT_STREAMING_STARTED:
DispatchJSEvent("obsStreamingStarted", "");
DispatchJSEvent("obsStreamingStarted", "null");
break;
case OBS_FRONTEND_EVENT_STREAMING_STOPPING:
DispatchJSEvent("obsStreamingStopping", "");
DispatchJSEvent("obsStreamingStopping", "null");
break;
case OBS_FRONTEND_EVENT_STREAMING_STOPPED:
DispatchJSEvent("obsStreamingStopped", "");
DispatchJSEvent("obsStreamingStopped", "null");
break;
case OBS_FRONTEND_EVENT_RECORDING_STARTING:
DispatchJSEvent("obsRecordingStarting", "");
DispatchJSEvent("obsRecordingStarting", "null");
break;
case OBS_FRONTEND_EVENT_RECORDING_STARTED:
DispatchJSEvent("obsRecordingStarted", "");
DispatchJSEvent("obsRecordingStarted", "null");
break;
case OBS_FRONTEND_EVENT_RECORDING_PAUSED:
DispatchJSEvent("obsRecordingPaused", "");
DispatchJSEvent("obsRecordingPaused", "null");
break;
case OBS_FRONTEND_EVENT_RECORDING_UNPAUSED:
DispatchJSEvent("obsRecordingUnpaused", "");
DispatchJSEvent("obsRecordingUnpaused", "null");
break;
case OBS_FRONTEND_EVENT_RECORDING_STOPPING:
DispatchJSEvent("obsRecordingStopping", "");
DispatchJSEvent("obsRecordingStopping", "null");
break;
case OBS_FRONTEND_EVENT_RECORDING_STOPPED:
DispatchJSEvent("obsRecordingStopped", "");
DispatchJSEvent("obsRecordingStopped", "null");
break;
case OBS_FRONTEND_EVENT_REPLAY_BUFFER_STARTING:
DispatchJSEvent("obsReplaybufferStarting", "");
DispatchJSEvent("obsReplaybufferStarting", "null");
break;
case OBS_FRONTEND_EVENT_REPLAY_BUFFER_STARTED:
DispatchJSEvent("obsReplaybufferStarted", "");
DispatchJSEvent("obsReplaybufferStarted", "null");
break;
case OBS_FRONTEND_EVENT_REPLAY_BUFFER_SAVED:
DispatchJSEvent("obsReplaybufferSaved", "");
DispatchJSEvent("obsReplaybufferSaved", "null");
break;
case OBS_FRONTEND_EVENT_REPLAY_BUFFER_STOPPING:
DispatchJSEvent("obsReplaybufferStopping", "");
DispatchJSEvent("obsReplaybufferStopping", "null");
break;
case OBS_FRONTEND_EVENT_REPLAY_BUFFER_STOPPED:
DispatchJSEvent("obsReplaybufferStopped", "");
DispatchJSEvent("obsReplaybufferStopped", "null");
break;
case OBS_FRONTEND_EVENT_VIRTUALCAM_STARTED:
DispatchJSEvent("obsVirtualcamStarted", "");
DispatchJSEvent("obsVirtualcamStarted", "null");
break;
case OBS_FRONTEND_EVENT_VIRTUALCAM_STOPPED:
DispatchJSEvent("obsVirtualcamStopped", "");
DispatchJSEvent("obsVirtualcamStopped", "null");
break;
case OBS_FRONTEND_EVENT_SCENE_CHANGED: {
OBSSourceAutoRelease source = obs_frontend_get_current_scene();
Expand Down Expand Up @@ -642,7 +642,9 @@ static void handle_obs_frontend_event(enum obs_frontend_event event, void *)
if (!name)
break;

DispatchJSEvent("obsTransitionChanged", name);
nlohmann::json json = {{"name", name}};

DispatchJSEvent("obsTransitionChanged", json.dump());
break;
}
case OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED: {
Expand All @@ -661,7 +663,7 @@ static void handle_obs_frontend_event(enum obs_frontend_event event, void *)
break;
}
case OBS_FRONTEND_EVENT_EXIT:
DispatchJSEvent("obsExit", "");
DispatchJSEvent("obsExit", "null");
break;
default:;
}
Expand Down
Loading