mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Merge pull request #33 from haganbmj/master
[Protocol] Add OnTransitionChange/OnTransitionListChange (Fixes #19)
This commit is contained in:
commit
7ece78a05b
17
PROTOCOL.md
17
PROTOCOL.md
@ -26,6 +26,13 @@ OBS is switching to another scene.
|
||||
#### "ScenesChanged"
|
||||
The scene list has been modified (Scenes have been added, removed, or renamed).
|
||||
|
||||
#### "SwitchTransition"
|
||||
The active transition has been changed.
|
||||
- **transition-name** (string) : The name of the active transition.
|
||||
|
||||
#### "TransitionListChanged"
|
||||
The list of available transitions has been modified (Transitions have been added, removed, or renamed).
|
||||
|
||||
#### "StreamStarting"
|
||||
A request to start streaming has been issued.
|
||||
- **preview-only** (bool) : Always false.
|
||||
@ -50,7 +57,7 @@ A request to start recording has been issued.
|
||||
Recording started successfully.
|
||||
*New in OBS Studio*
|
||||
|
||||
#### "RecordingStopping"
|
||||
#### "RecordingStopping"
|
||||
A request to stop streaming has been issued.
|
||||
*New in OBS Studio*
|
||||
|
||||
@ -93,7 +100,7 @@ Depending on the request type additional fields may be present (see the "[Reques
|
||||
|
||||
### Request Types
|
||||
#### "GetVersion"
|
||||
Returns the latest version of the plugin and the API.
|
||||
Returns the latest version of the plugin and the API.
|
||||
|
||||
__Request fields__ : none
|
||||
__Response__ : always OK, with these additional fields :
|
||||
@ -165,12 +172,12 @@ Toggle streaming on or off.
|
||||
__Request fields__ : none
|
||||
__Response__ : always OK. No additional fields.
|
||||
|
||||
#### "StartStopRecording"
|
||||
#### "StartStopRecording"
|
||||
Toggle recording on or off.
|
||||
|
||||
__Request fields__ : none
|
||||
__Response__ : always OK. No additional fields.
|
||||
*New in OBS Studio*
|
||||
*New in OBS Studio*
|
||||
|
||||
#### "GetStreamingStatus"
|
||||
Get current streaming and recording status.
|
||||
@ -211,7 +218,7 @@ __Response__ : OK if specified transition exists, error otherwise.
|
||||
|
||||
*New in OBS Studio*
|
||||
|
||||
### Authentication
|
||||
### Authentication
|
||||
A call to `GetAuthRequired` gives the client two elements :
|
||||
- A challenge : a random string that will be used to generate the auth response
|
||||
- A salt : applied to the password when generating the auth response
|
||||
|
23
WSEvents.cpp
23
WSEvents.cpp
@ -43,6 +43,12 @@ void WSEvents::FrontendEventHandler(enum obs_frontend_event event, void *private
|
||||
else if (event == OBS_FRONTEND_EVENT_SCENE_LIST_CHANGED) {
|
||||
owner->OnSceneListChange();
|
||||
}
|
||||
else if (event == OBS_FRONTEND_EVENT_TRANSITION_CHANGED) {
|
||||
owner->OnTransitionChange();
|
||||
}
|
||||
else if (event == OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED) {
|
||||
owner->OnTransitionListChange();
|
||||
}
|
||||
else if (event == OBS_FRONTEND_EVENT_STREAMING_STARTING) {
|
||||
owner->OnStreamStarting();
|
||||
}
|
||||
@ -126,6 +132,23 @@ void WSEvents::OnSceneListChange() {
|
||||
broadcastUpdate("ScenesChanged");
|
||||
}
|
||||
|
||||
void WSEvents::OnTransitionChange() {
|
||||
obs_source_t *transition = obs_frontend_get_current_transition();
|
||||
const char *transition_name = obs_source_get_name(transition);
|
||||
|
||||
obs_data_t *data = obs_data_create();
|
||||
obs_data_set_string(data, "transition-name", transition_name);
|
||||
|
||||
broadcastUpdate("SwitchTransition", data);
|
||||
|
||||
obs_data_release(data);
|
||||
obs_source_release(transition);
|
||||
}
|
||||
|
||||
void WSEvents::OnTransitionListChange() {
|
||||
broadcastUpdate("TransitionListChanged");
|
||||
}
|
||||
|
||||
void WSEvents::OnStreamStarting() {
|
||||
// Implements an existing update type from bilhamil's OBS Remote
|
||||
obs_data_t *data = obs_data_create();
|
||||
|
@ -47,6 +47,9 @@ class WSEvents : public QObject
|
||||
void OnSceneChange();
|
||||
void OnSceneListChange();
|
||||
|
||||
void OnTransitionChange();
|
||||
void OnTransitionListChange();
|
||||
|
||||
void OnStreamStarting();
|
||||
void OnStreamStarted();
|
||||
void OnStreamStopping();
|
||||
|
Loading…
x
Reference in New Issue
Block a user