Layout
Layouts are a core feature of Eyeson One View. Make sure to consult the how-tos for detailed examples.
Set a Layout
POST /rooms/`ACCESS_KEY`/layout
RESPONSES 200 OK, 400 BAD REQUEST, 404 NOT FOUND, 405 METHOD NOT ALLOWED, 410 GONE
RECOMMENDED name, users
Req/Res Example: Set a Layout
- curl
- node sdk
- go sdk
- php sdk
export ACCESS_KEY=...
curl -X POST \
-H "Content-Type: application/json" \
-d "{\"layout\": \"auto\", \"show_names\": true, \"name\": \"four\", \"users\": ['','','','']}" \
"https://api.eyeson.team/rooms/$ACCESS_KEY/layout"
const eyeson = new Eyeson();
const user = await eyeson.getUser(accessKey);
await user.setLayout({
layout: 'auto',
name: 'four',
users: ['', '', '', ''],
show_names: true,
});
accessKey := "..."
showNames := true
userService, _ := eyeson.NewUserServiceFromAccessKey(accessKey)
userService.SetLayout(eyeson.Auto, &eyeson.SetLayoutOptions{
LayoutName: "four",
Users: []string{"", "", "", ""},
ShowNames: &showNames,
})
$accessKey = '...';
$eyeson = new Eyeson();
$layout = $eyeson->layout($accessKey);
$layout->apply([
'layout' => 'auto',
'name' => 'four',
'users' => ['', '', '', ''],
'show_names' => true
]);
No Response
layout
Type: STRING (optional)
Default: auto
Controls the behaviour of the session layout. See examples below.
| Value | Description |
|---|---|
auto | Automatically adjusts layouts based on the number of participants. ● Can be used alone or omitted (defaults to auto).● Functions with the name parameter without requiring a users array.● Functions with the map parameter without requiring a users array.● When using a users array, include either a name or map parameter.● The users array should contain entries corresponding to the number of positions in the layout. |
custom | Maintains manually assigned positions; empty positions remain vacant. ● Requires a layout definition using either the name or map parameter, and a users array.● Using the name parameter alone (without a users array) will result in an error.● The users array should contain entries corresponding to the number of positions defined in the layout. |
map and name Interaction
When providing both map and name parameters:
- Name can be any arbitrary
STRINGvalue - The provided
nameis stored and returned with the layout definition - This enables tracking which layout is currently active in your application
- Common implementation: Define several layout maps with descriptive names for easy reference and switching
Empty custom Layout Use Case
Setting a custom layout with empty positions is permitted when:
- Layout is set to
custom nameparameter is specified- users array is included (even if some positions are empty)
By leaving out specific spots when the layout is set to custom,
you can show parts of an image in the background layer.
name
Type: STRING (optional)
Use named layouts like one, two, etc. See the list of all predefined layouts. See custom layout map for more details.
When the map parameter is set any name can be used.
map
Type: STRING or LIST (optional)
Defines a custom layout map. JSON formatted string or list of the format [[x, y, width, height, fitting],[...]]. See fitting behaviours below.
[
[0, 0, 640, 720, "cover"],
[640, 0, 640, 720, "cover"]
]
Max. 10 spots are allowed for each custom layout.
users
Type: LIST (optional)
List of user IDs in an Eyeson One View stream, a custom layout position identifier or an empty string for an empty spot.
It is required to add a user for each spot in the layout. See the example below.
show_names
Type: BOOLEAN (optional)
Default: true
Show display names in video.
If the width of a spot is below 250, the names are initialed.
voice_activation
Type: BOOLEAN (optional)
Default: false
Users who are not included in the layout are automatically repositioned into the layout when they demonstrate voice activity. If no empty slot is available, a user who is currently inactive will be replaced by the incoming active voice user.
audio_insert
Type: STRING (optional)
Default: audio_only
Displays the audio activity of participants.
| Value | Description |
|---|---|
enabled | Shows audio activity inserts of all participants |
disabled | Completely disables audio activity inserts |
audio_only | Only shows audio activity inserts for participants who are not in the video stream. |
audio_insert_position[x]
Type: NUMBER (optional)
X position value of the audio insert.