mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Merge pull request #338 from Rosuav/open-projector
Create a command for opening a projector.
This commit is contained in:
commit
6d63779c70
@ -3354,6 +3354,67 @@
|
|||||||
"lead": "",
|
"lead": "",
|
||||||
"type": "class",
|
"type": "class",
|
||||||
"examples": []
|
"examples": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"subheads": [],
|
||||||
|
"description": "Open a projector window or create a projector on a monitor. Requires OBS v24.0.4 or newer.",
|
||||||
|
"param": [
|
||||||
|
"{String (Optional)} `type` Type of projector: Preview (default), Source, Scene, StudioProgram, or Multiview (case insensitive).",
|
||||||
|
"{int (Optional)} `monitor` Monitor to open the projector on. If -1 or omitted, opens a window.",
|
||||||
|
"{String (Optional)} `geometry` Size and position of the projector window (only if monitor is -1). Encoded in base 64.",
|
||||||
|
"{String (Optional)} `name` Name of the source or scene to be displayed (ignored for other projector types)."
|
||||||
|
],
|
||||||
|
"api": "requests",
|
||||||
|
"name": "OpenProjector",
|
||||||
|
"category": "general",
|
||||||
|
"since": "4.7.0",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "String (Optional)",
|
||||||
|
"name": "type",
|
||||||
|
"description": "Type of projector: Preview (default), Source, Scene, StudioProgram, or Multiview (case insensitive)."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int (Optional)",
|
||||||
|
"name": "monitor",
|
||||||
|
"description": "Monitor to open the projector on. If -1 or omitted, opens a window."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "String (Optional)",
|
||||||
|
"name": "geometry",
|
||||||
|
"description": "Size and position of the projector window (only if monitor is -1). Encoded in base 64."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "String (Optional)",
|
||||||
|
"name": "name",
|
||||||
|
"description": "Name of the source or scene to be displayed (ignored for other projector types)."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"names": [
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"description": "OpenProjector"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"categories": [
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"description": "general"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sinces": [
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"description": "4.7.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"heading": {
|
||||||
|
"level": 2,
|
||||||
|
"text": "OpenProjector"
|
||||||
|
},
|
||||||
|
"lead": "",
|
||||||
|
"type": "class",
|
||||||
|
"examples": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"outputs": [
|
"outputs": [
|
||||||
|
@ -119,6 +119,7 @@ auth_response = base64_encode(auth_response_hash)
|
|||||||
+ [GetStats](#getstats)
|
+ [GetStats](#getstats)
|
||||||
+ [BroadcastCustomMessage](#broadcastcustommessage-1)
|
+ [BroadcastCustomMessage](#broadcastcustommessage-1)
|
||||||
+ [GetVideoInfo](#getvideoinfo)
|
+ [GetVideoInfo](#getvideoinfo)
|
||||||
|
+ [OpenProjector](#openprojector)
|
||||||
* [Outputs](#outputs)
|
* [Outputs](#outputs)
|
||||||
+ [ListOutputs](#listoutputs)
|
+ [ListOutputs](#listoutputs)
|
||||||
+ [GetOutputInfo](#getoutputinfo)
|
+ [GetOutputInfo](#getoutputinfo)
|
||||||
@ -1353,6 +1354,29 @@ _No specified parameters._
|
|||||||
| `colorRange` | _String_ | Color range (full or partial) |
|
| `colorRange` | _String_ | Color range (full or partial) |
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### OpenProjector
|
||||||
|
|
||||||
|
|
||||||
|
- Added in v4.7.0
|
||||||
|
|
||||||
|
Open a projector window or create a projector on a monitor. Requires OBS v24.0.4 or newer.
|
||||||
|
|
||||||
|
**Request Fields:**
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| ---- | :---: | ------------|
|
||||||
|
| `type` | _String (Optional)_ | Type of projector: Preview (default), Source, Scene, StudioProgram, or Multiview (case insensitive). |
|
||||||
|
| `monitor` | _int (Optional)_ | Monitor to open the projector on. If -1 or omitted, opens a window. |
|
||||||
|
| `geometry` | _String (Optional)_ | Size and position of the projector window (only if monitor is -1). Encoded in base 64. |
|
||||||
|
| `name` | _String (Optional)_ | Name of the source or scene to be displayed (ignored for other projector types). |
|
||||||
|
|
||||||
|
|
||||||
|
**Response Items:**
|
||||||
|
|
||||||
|
_No additional response items._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
@ -36,6 +36,7 @@ const QHash<QString, RpcMethodHandler> WSRequestHandler::messageMap {
|
|||||||
{ "GetStats", &WSRequestHandler::GetStats },
|
{ "GetStats", &WSRequestHandler::GetStats },
|
||||||
{ "SetHeartbeat", &WSRequestHandler::SetHeartbeat },
|
{ "SetHeartbeat", &WSRequestHandler::SetHeartbeat },
|
||||||
{ "GetVideoInfo", &WSRequestHandler::GetVideoInfo },
|
{ "GetVideoInfo", &WSRequestHandler::GetVideoInfo },
|
||||||
|
{ "OpenProjector", &WSRequestHandler::OpenProjector },
|
||||||
|
|
||||||
{ "SetFilenameFormatting", &WSRequestHandler::SetFilenameFormatting },
|
{ "SetFilenameFormatting", &WSRequestHandler::SetFilenameFormatting },
|
||||||
{ "GetFilenameFormatting", &WSRequestHandler::GetFilenameFormatting },
|
{ "GetFilenameFormatting", &WSRequestHandler::GetFilenameFormatting },
|
||||||
|
@ -54,6 +54,7 @@ class WSRequestHandler {
|
|||||||
RpcResponse GetStats(const RpcRequest&);
|
RpcResponse GetStats(const RpcRequest&);
|
||||||
RpcResponse SetHeartbeat(const RpcRequest&);
|
RpcResponse SetHeartbeat(const RpcRequest&);
|
||||||
RpcResponse GetVideoInfo(const RpcRequest&);
|
RpcResponse GetVideoInfo(const RpcRequest&);
|
||||||
|
RpcResponse OpenProjector(const RpcRequest&);
|
||||||
|
|
||||||
RpcResponse SetFilenameFormatting(const RpcRequest&);
|
RpcResponse SetFilenameFormatting(const RpcRequest&);
|
||||||
RpcResponse GetFilenameFormatting(const RpcRequest&);
|
RpcResponse GetFilenameFormatting(const RpcRequest&);
|
||||||
|
@ -304,3 +304,32 @@ RpcResponse WSRequestHandler::GetVideoInfo(const RpcRequest& request) {
|
|||||||
|
|
||||||
return request.success(response);
|
return request.success(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open a projector window or create a projector on a monitor. Requires OBS v24.0.4 or newer.
|
||||||
|
*
|
||||||
|
* @param {String (Optional)} `type` Type of projector: Preview (default), Source, Scene, StudioProgram, or Multiview (case insensitive).
|
||||||
|
* @param {int (Optional)} `monitor` Monitor to open the projector on. If -1 or omitted, opens a window.
|
||||||
|
* @param {String (Optional)} `geometry` Size and position of the projector window (only if monitor is -1). Encoded in Base64 using Qt's geometry encoding (https://doc.qt.io/qt-5/qwidget.html#saveGeometry). Corresponds to OBS's saved projectors.
|
||||||
|
* @param {String (Optional)} `name` Name of the source or scene to be displayed (ignored for other projector types).
|
||||||
|
*
|
||||||
|
* @api requests
|
||||||
|
* @name OpenProjector
|
||||||
|
* @category general
|
||||||
|
* @since unreleased
|
||||||
|
*/
|
||||||
|
RpcResponse WSRequestHandler::OpenProjector(const RpcRequest& request) {
|
||||||
|
#if LIBOBS_API_VER >= 0x18000004
|
||||||
|
const char *type = obs_data_get_string(request.parameters(), "type");
|
||||||
|
int monitor = -1;
|
||||||
|
if (request.hasField("monitor")) {
|
||||||
|
monitor = obs_data_get_int(request.parameters(), "monitor");
|
||||||
|
}
|
||||||
|
const char *geometry = obs_data_get_string(request.parameters(), "geometry");
|
||||||
|
const char *name = obs_data_get_string(request.parameters(), "name");
|
||||||
|
obs_frontend_open_projector(type, monitor, geometry, name);
|
||||||
|
return request.success();
|
||||||
|
#else
|
||||||
|
return request.failed("Projector opening requires libobs v24.0.4 or newer.");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user