Create scene
1. API Description
This API is used to create a new scene or note containing the specific source (the function of creating note is not yet open to the public).
Request mode:
- V2.6.0 and above: POST [ip]/mwapi/V2.0/scene/create-scene-with-source
- V2.5.0 and below: POST [ip]/mwapi/create-scene-with-source
| Administrator Rights | Logged-in |
|---|---|
| No | Yes |
2. Input Parameters
| Name | Required | Type | Description |
|---|---|---|---|
| sourceId | Yes | Int | Resource ID, which can be obtained via Get resource list |
| sceneName | No | String | Scene name, optional parameter, only valid for a scene |
| type | No | int | Scene type, 0: Scene (default); 4: Note |
3. Output Parameters
| Name | Type | Description |
|---|---|---|
| status | Int | Status code |
| message | String | Status description |
| info | InfoData | Scene information. |
Note: Unless otherwise specified, when the values of the following parameters are 0, it generally means that there are no such resources.
InfoData
| Name | Type | Description |
|---|---|---|
| audioList | AudioListData | Audio configuration information in a layer |
| bglayer | LayerData | Layer information |
| dividerLine | DividerLineData | Separator attributes |
| id | Int | Scene ID |
| layerList | LayerData | Array of layers |
| name | String | Scene name |
| sceneGfxInfo | Int | The on-screen GFX information. The subordinate parameter sceneGfxId is the ID of the on-screen GFX |
| template | Int | Scene combination mode 0: Picture-in-picture; 1: Side-by-side; 2: Single scene |
| type | Int | Scene type 4: Note; Other numbers: Scene |
AudioListData
| Name | Type | Description |
|---|---|---|
| layerId | Int | Layer ID, the layer position in the layer array |
| muted | Int | Whether it is muted. 0: No; 1: Yes |
| type | Int | Audio type 0x0100: HDMI 1; 0x0200: Video; 0x0300: HDMI 2; 0x0400: USB Camera; 0x0500: Picture; 0x0700: Web page |
| volume | Int | Volume, ranging from 0 to 1000000 |
LayerData
| Name | Type | Description |
|---|---|---|
| alpha | Int | The alpha attribute of the layer |
| cropWindow | WindowData | The attribute of the cropped window |
| fixed | Int | Whether it is a GFX template layer 0: No; 1: Yes |
| flip | Int | The flip attribute 0: No flip 1: Flip horizontally 2: Flip vertically 3: Flip horizontally and vertically |
| frame | FrameData | The frame attribute |
| givenBg | Int | Whether it is a note background image uploaded by the user 1: Yes; 0: No |
| mediaProgress | Int | The playback progress of video source |
| pdfPosition | Int | PDF location information, (page number - 1) * 100 |
| pdfScaleMode | Int | PDF zoom mode 0: Free 1: Maintain original page ratio 2: Fit content to screen 3: Fit width to screen |
| pdfScaleValue | Int | PDF zoom attribute, ranging from 1 to 5 * 10000 |
| rotation | Int | Rotation angle, in the counterclockwise direction, ranging from 0 to 360 |
| scaleX | Int | Scaling ratio on the X-axis, ranging from 0 to 1000000 |
| scaleY | Int | Scaling ratio on the Y-axis, ranging from 0 to 1000000 |
| sourceColor | Int | Color value of the solid-color layer, of type uint32 (GBRA) |
| sourceDuration | Int | Length of the source video |
| sourceHeight | Int | Height of the source frame |
| sourceId | Int | Resource ID, the unique identifier of the resource in the device |
| sourceThumbHeight | Int | Height of the source thumbnail |
| sourceThumbWidth | Int | Width of the source thumbnail |
| sourceTotalPageNumber | Int | Number of pages in the PDF file |
| sourceType | Int | Source type 1: Picture; 2: Video; 3: HDMI 1; 4: HDMI 2; 5: USB-Camera; 6: Audio; 7: Background image |
| sourceWidth | Int | Width of the source scene |
| srcWindow | WindowData | Content window properties |
| url | String | Web page address |
| videoPolicy | Int | Video end policy 0: Show last frame 1: Repeat video 2: Switch to scene X 3: Show first frame 4: Go to black 5: Hide video |
| videoPolicyIn | Int | Video start policy 0: Auto start; 1: Manual start |
| videoPolicyNextScene | Int | When the video end policy is to switch to scene X, it refers to the ID of the target scene |
| videoPolicyOut | Int | When the video is switched out before it ends and then switched back, how the video will continue 0: Keeps the progress where you left off 1: Rewinds to the start of video |
| videoRangeEnd | Int | Video cutting start position, in ms |
| videoRangeStart | Int | Video cutting end position, in ms |
| webScaleValue | Int | Web page zoom attribute, with a value range from 1 to 5 * 10000 |
| window | WindowData | Window properties |
WindowData
| Name | Type | Description |
|---|---|---|
| x | Int | X-axis position, relative value (0~1)×1,000,000 |
| y | Int | Y-axis position, relative value (0~1)×1,000,000 |
| width | Int | Window width |
| height | Int | Window height |
| type | Int | Cropping type 0: Free 1: Original 2: 4:3 3: 16:9 4: 1:1 |
FrameData
| Name | Type | Description |
|---|---|---|
| color | Int | Frame color, of type uint32 (GBRA) |
| width | Int | Frame width, in px |
DividerLineData
| Name | Type | Description |
|---|---|---|
| color | Int | Separator color, of type uint32 (GBRA) |
| x1 | Int | X-axis position of the vertex of the separator, relative value (0 - 1) * 1,000,000 |
| y1 | Int | Y-axis position of the vertex of the separator, relative value (0 - 1) * 1,000,000 |
| x2 | Int | X-axis position of the end point of the separator, relative value (0 - 1) * 1,000,000 |
| y2 | Int | Y-axis position of the end point of the separator, relative value (0 - 1) * 1,000,000 |
4. Example
Adding the file with ID 5 as a scene, named as New Scene.
Input Example
{
"sourceId": 5,
"sceneName": "New Scene"
}
Output Example
{
"info": {
"audioList": [
{
"layerId": 0,
"muted": 0,
"volume": 1000000
}
],
"bgLayer": {
"alpha": 1000000,
"cropWindow": {
"height": 1000000,
"type": 0,
"width": 1000000,
"x": 0,
"y": 0
},
"fixed": 0,
"flip": 0,
"frame": {
"color": 0,
"width": 0
},
"givenBg": 0,
"mediaProgress": 0,
"pdfPosition": 0,
"pdfScaleMode": 3,
"pdfScaleValue": 10000,
"rotation": 0,
"scaleX": 1000000,
"scaleY": 1000000,
"sourceColor": 255,
"sourceDuration": 0,
"sourceHeight": 0,
"sourceId": 0,
"sourceThumbHeight": 0,
"sourceThumbWidth": 0,
"sourceTotalPageNumber": 0,
"sourceType": 12,
"sourceWidth": 0,
"srcWindow": {
"height": 1000000,
"width": 1000000,
"x": 0,
"y": 0
},
"videoPolicy": 0,
"videoPolicyIn": 0,
"videoPolicyNextScene": 0,
"videoPolicyOut": 0,
"videoRangeEnd": 0,
"videoRangeStart": 0,
"webScaleValue": 10000,
"window": {
"height": 1000000,
"width": 1000000,
"x": 0,
"y": 0
}
},
"dividerLine": {
"color": 0,
"width": 0,
"x1": 500000,
"x2": 500000,
"y1": 0,
"y2": 1000000
},
"id": 100,
"layerList": [
{
"alpha": 1000000,
"cropWindow": {
"height": 1000000,
"type": 1,
"width": 1000000,
"x": 0,
"y": 0
},
"fixed": 0,
"flip": 0,
"frame": {
"color": 16777215,
"width": 0
},
"givenBg": 0,
"mediaProgress": 0,
"pdfPosition": 0,
"pdfScaleMode": 3,
"pdfScaleValue": 10000,
"rotation": 360,
"scaleX": 1000000,
"scaleY": 1000000,
"sourceColor": 255,
"sourceDuration": 0,
"sourceHeight": 3840,
"sourceId": 5,
"sourceThumbHeight": 170,
"sourceThumbWidth": 256,
"sourceTotalPageNumber": 0,
"sourceType": 1,
"sourceWidth": 5760,
"srcWindow": {
"height": 1000000,
"width": 843750,
"x": 78125,
"y": 0
},
"url": "",
"videoPolicy": 0,
"videoPolicyIn": 0,
"videoPolicyNextScene": 0,
"videoPolicyOut": 0,
"videoRangeEnd": 0,
"videoRangeStart": 0,
"webScaleValue": 10000,
"window": {
"height": 1000000,
"width": 1000000,
"x": 0,
"y": 0
}
},
{
"alpha": 1000000,
"cropWindow": {
"height": 1000000,
"type": 0,
"width": 1000000,
"x": 0,
"y": 0
},
"fixed": 0,
"flip": 0,
"frame": {
"color": 0,
"width": 0
},
"givenBg": 0,
"mediaProgress": 0,
"pdfPosition": 0,
"pdfScaleMode": 3,
"pdfScaleValue": 10000,
"rotation": 0,
"scaleX": 1000000,
"scaleY": 1000000,
"sourceColor": 255,
"sourceDuration": 0,
"sourceHeight": 0,
"sourceId": 0,
"sourceThumbHeight": 0,
"sourceThumbWidth": 0,
"sourceTotalPageNumber": 0,
"sourceType": 0,
"sourceWidth": 0,
"srcWindow": {
"height": 1000000,
"width": 1000000,
"x": 0,
"y": 0
},
"videoPolicy": 0,
"videoPolicyIn": 0,
"videoPolicyNextScene": 0,
"videoPolicyOut": 0,
"videoRangeEnd": 0,
"videoRangeStart": 0,
"webScaleValue": 10000,
"window": {
"height": 0,
"width": 0,
"x": 0,
"y": 0
}
}
],
"name": "New Scene",
"sceneGfxInfo": {
"sceneGfxId": 0
},
"template": 2,
"type": 3
},
"message": "success",
"status": 0
}
5. Error Code
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
| Status | Definition | Description |
|---|---|---|
| 5 | RESULT_CODE_SYSTEM_ERROR | No such resource or system error |
| 7 | MW_STATUS_INVALID_ARG | Missing required parameters |
| 11 | MW_STATUS_DEVICE_BUSY | A scene editing task is going on, and the operation is forbidden |