mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Merge pull request #503 from Palakis/feature/get-tr-pos
Requests: Add GetTransitionPosition
This commit is contained in:
commit
eb206549ff
@ -84,6 +84,7 @@ const QHash<QString, RpcMethodHandler> WSRequestHandler::messageMap {
|
|||||||
{ "SetCurrentTransition", &WSRequestHandler::SetCurrentTransition },
|
{ "SetCurrentTransition", &WSRequestHandler::SetCurrentTransition },
|
||||||
{ "SetTransitionDuration", &WSRequestHandler::SetTransitionDuration },
|
{ "SetTransitionDuration", &WSRequestHandler::SetTransitionDuration },
|
||||||
{ "GetTransitionDuration", &WSRequestHandler::GetTransitionDuration },
|
{ "GetTransitionDuration", &WSRequestHandler::GetTransitionDuration },
|
||||||
|
{ "GetTransitionPosition", &WSRequestHandler::GetTransitionPosition },
|
||||||
|
|
||||||
{ "SetVolume", &WSRequestHandler::SetVolume },
|
{ "SetVolume", &WSRequestHandler::SetVolume },
|
||||||
{ "GetVolume", &WSRequestHandler::GetVolume },
|
{ "GetVolume", &WSRequestHandler::GetVolume },
|
||||||
|
@ -99,6 +99,9 @@ class WSRequestHandler {
|
|||||||
RpcResponse GetTransitionList(const RpcRequest&);
|
RpcResponse GetTransitionList(const RpcRequest&);
|
||||||
RpcResponse GetCurrentTransition(const RpcRequest&);
|
RpcResponse GetCurrentTransition(const RpcRequest&);
|
||||||
RpcResponse SetCurrentTransition(const RpcRequest&);
|
RpcResponse SetCurrentTransition(const RpcRequest&);
|
||||||
|
RpcResponse SetTransitionDuration(const RpcRequest&);
|
||||||
|
RpcResponse GetTransitionDuration(const RpcRequest&);
|
||||||
|
RpcResponse GetTransitionPosition(const RpcRequest&);
|
||||||
|
|
||||||
RpcResponse SetVolume(const RpcRequest&);
|
RpcResponse SetVolume(const RpcRequest&);
|
||||||
RpcResponse GetVolume(const RpcRequest&);
|
RpcResponse GetVolume(const RpcRequest&);
|
||||||
@ -138,9 +141,6 @@ class WSRequestHandler {
|
|||||||
RpcResponse SendCaptions(const RpcRequest&);
|
RpcResponse SendCaptions(const RpcRequest&);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RpcResponse SetTransitionDuration(const RpcRequest&);
|
|
||||||
RpcResponse GetTransitionDuration(const RpcRequest&);
|
|
||||||
|
|
||||||
RpcResponse GetStudioModeStatus(const RpcRequest&);
|
RpcResponse GetStudioModeStatus(const RpcRequest&);
|
||||||
RpcResponse GetPreviewScene(const RpcRequest&);
|
RpcResponse GetPreviewScene(const RpcRequest&);
|
||||||
RpcResponse SetPreviewScene(const RpcRequest&);
|
RpcResponse SetPreviewScene(const RpcRequest&);
|
||||||
|
@ -120,3 +120,22 @@ RpcResponse WSRequestHandler::GetTransitionDuration(const RpcRequest& request) {
|
|||||||
obs_data_set_int(response, "transition-duration", obs_frontend_get_transition_duration());
|
obs_data_set_int(response, "transition-duration", obs_frontend_get_transition_duration());
|
||||||
return request.success(response);
|
return request.success(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the position of the current transition.
|
||||||
|
*
|
||||||
|
* @return {double} `position` current transition position. This value will be between 0.0 and 1.0. Note: Transition returns 1.0 when not active.
|
||||||
|
*
|
||||||
|
* @api requests
|
||||||
|
* @name GetTransitionPosition
|
||||||
|
* @category transitions
|
||||||
|
* @since 4.8.0
|
||||||
|
*/
|
||||||
|
RpcResponse WSRequestHandler::GetTransitionPosition(const RpcRequest& request) {
|
||||||
|
OBSSourceAutoRelease currentTransition = obs_frontend_get_current_transition();
|
||||||
|
|
||||||
|
OBSDataAutoRelease response = obs_data_create();
|
||||||
|
obs_data_set_double(response, "position", obs_transition_get_time(currentTransition));
|
||||||
|
|
||||||
|
return request.success(response);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user