...
Code Block | ||||
---|---|---|---|---|
| ||||
POST /rest-api/mixer/startup HTTP/1.1 HOST: 192.168.1.101:8081 Content-type: application/json { "uri": "mixer://mixer1", "localStreamName": "mixer1_stream", "hasVideo": true, "hasAudio": false, "mixerLayoutDir": "/opt/mixer1-layout" } |
Layout description file format
...
Applying a custom layout to an active mixer on the fly
Since build 5.2.1480, a custom mixer layout may be applied to an active mixer on the fly
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<?xml version="1.0" encoding="UTF-8"?> <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="body" type="bodyType"/> <xs:complexType name="videoType"> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="value" type="xs:string"/> <xs:attribute type="xs:int" name="x" default="0"/> <xs:attribute type="xs:int" name="y" default="0POST /rest-api/mixer/set_parameter HTTP/1.1 HOST: 192.168.1.101:8081 Content-type: application/json { "uri": "mixer://mixer1", "mixerLayoutDir": "/opt/mixer1-layout" } |
To roll back to default mixer layout set the empty mixerLayoutDir
parameter
Code Block | ||||
---|---|---|---|---|
| ||||
POST /rest-api/mixer/set_parameter HTTP/1.1
HOST: 192.168.1.101:8081
Content-type: application/json
{
"uri": "mixer://mixer1",
"mixerLayoutDir": ""
} |
In this case, a mixer layout class set in mixerLayoutClass
parameter will be applied.
Layout description file format
Layout description XML file must conform tho the following XSD scheme
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<?xml version="1.0" encoding="UTF-8"?> <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="body" type="bodyType"/> <xs:complexType name="videoType"> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="value" type="xs:string"/> <xs:attribute type="xs:stringint" name="widthx" default="0"/> <xs:attribute type="xs:stringint" name="heighty" default="0"/> <xs:attribute type="xs:string" name="alignwidth" default="0"/> <xs:attribute type="xs:string" name="height" default="0"/> <xs:attribute type="xs:string" name="align" default="LEFT"/> <xs:attribute type="xs:string" name="watermark"/> <xs:attribute type="xs:int" name="padding-left" default="0"/> <xs:attribute type="xs:int" name="padding-right" default="0"/> <xs:attribute type="xs:int" name="padding-top" default="0"/> <xs:attribute type="xs:int" name="padding-bottom" default="0"/> <xs:attribute type="xs:boolean" name="crop" default="false"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="divType"> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:choice> <xs:element name="video" type="videoType"/> <xs:element name="div" type="divType"/> <xs:element name="row" type="rowType"/> </xs:choice> </xs:sequence> <xs:attribute type="xs:int" name="x" default="0"/> <xs:attribute type="xs:int" name="y" default="0"/> <xs:attribute type="xs:string" name="width" default="0"/> <xs:attribute type="xs:string" name="height" default="0"/> <xs:attribute type="xs:string" name="align" default="LEFT"/> <xs:attribute type="xs:int" name="padding-left" default="0"/> <xs:attribute type="xs:int" name="padding-right" default="0"/> <xs:attribute type="xs:int" name="padding-top" default="0"/> <xs:attribute type="xs:int" name="padding-bottom" default="0"/> </xs:complexType> <xs:complexType name="rowType"> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:choice> <xs:element name="video" type="videoType"/> <xs:element name="div" type="divType"/> <xs:element name="row" type="rowType"/> </xs:choice> </xs:sequence> <xs:attribute type="xs:int" name="x" default="0"/> <xs:attribute type="xs:int" name="y" default="0"/> <xs:attribute type="xs:string" name="width" default="0"/> <xs:attribute type="xs:string" name="height" default="0"/> <xs:attribute type="xs:string" name="align" default="LEFT"/> <xs:attribute type="xs:int" name="padding-left" default="0"/> <xs:attribute type="xs:int" name="padding-right" default="0"/> <xs:attribute type="xs:int" name="padding-top" default="0"/> <xs:attribute type="xs:int" name="padding-bottom" default="0"/> </xs:complexType> <xs:complexType name="bodyType"> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:choice> <xs:element name="video" type="videoType"/> <xs:element name="div" type="divType"/> <xs:element name="row" type="rowType"/> </xs:choice> </xs:sequence> <xs:attribute type="xs:string" name="watermark"/> </xs:complexType> </xs:schema> |
...
- crop - crop a picture around the center
- id - position identifier to place a stream (since build 5.2.1950)
crop attribute may be true или false (by default).
...
id attribute accepts any value which must be unique within the XML picture layout descriptor file
Stream picture width
Since build 5.2.1052, a stream picture width can be set in pixels, parent element width percents, or in columns. This is supported for row element children only, for example
...
If the stream name does not meet any template in the file, and there is empty video element in the file, this element will be used for that stream. For example, here is a description for one participant
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="utf-8"?>
<body xsi:noNamespaceSchemaLocation="schema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<div width="320" height="180" padding-left="0" padding-right="0" padding-bottom="0" align="TOP_CENTER">
<video>test1.*</video>
</div>
<div width="320" height="180" padding-left="0" padding-right="0" padding-bottom="0" align="BOTTOM_CENTER">
<video>test2.*</video>
</div>
<div width="160" height="90" padding-left="0" padding-right="0" padding-bottom="0" align="RIGHT">
<video>.*</video>
</div>
</body> |
In this case test3 will be displayed in last video elementdescription for one participant
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="utf-8"?>
<body xsi:noNamespaceSchemaLocation="schema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<div width="320" height="180" padding-left="0" padding-right="0" padding-bottom="0" align="TOP_CENTER">
<video>test1.*</video>
</div>
<div width="320" height="180" padding-left="0" padding-right="0" padding-bottom="0" align="BOTTOM_CENTER">
<video>test2.*</video>
</div>
<div width="160" height="90" padding-left="0" padding-right="0" padding-bottom="0" align="RIGHT">
<video>.*</video>
</div>
</body> |
In this case test3 will be displayed in last video element
Placing the stream picture to a certain position by identifier
Since build 5.2.1950 it is possible to place the stream picture to a certain position by identifier. This may be suitable if stream name template cannot be used. Foe instance there is the layout descriptor file for three participants
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="utf-8"?>
<body>
<row height="100%" align="CENTER">
<video width="100%" id="desktop" align="CENTER"></video>
<row height="20%" align="BOTTOM">
<div width="1col" height="100%" align="INLINE_HORIZONTAL"><video width="95%" height="95%" id="speaker" align="RIGHT"/></div>
<div width="1col" height="100%" align="INLINE_HORIZONTAL"><video width="95%" height="95%" id="participant" align="LEFT"/></div>
</row>
</row>
</body> |
In this case the stream can be placed to the position with desktop
identifier using REST API query /mixer/set_position
:
Code Block | ||||
---|---|---|---|---|
| ||||
POST /rest-api/mixer/set_position HTTP/1.1
Host: localhost:8081
Content-Type: application/json
{
"uri": "mixer://mixer1",
"remoteStreamName": "stream3",
"videoPositionId": "desktop"
} |
The stream also can be added to the certain position:
Code Block | ||||
---|---|---|---|---|
| ||||
POST /rest-api/mixer/add HTTP/1.1
Host: localhost:8081
Content-Type: application/json
{
"uri": "mixer://mixer1",
"remoteStreamName": "stream1",
"videoPositionId": "speaker"
} |
Whole mixer or participant stream watermarking
...