How to Use Voice Activation
The voice_activation
parameter controls dynamic participant visibility in the video layout. By default, this parameter is set to false
.
When the number of participants exceeds available layout spots, voice activation automatically manages which participants are displayed. Active participants (those speaking and with cameras enabled) will dynamically replace inactive participants in the video stream.
Figure 1. This screenshot shows the
four
layout with five participants. With voice activation disabled, the fifth participant remains off-screen regardless of speaking status.
Figure 2. With voice activation enabled, the fifth participant appears in the layout when they begin speaking.
You can implement this feature using the code snippets below.
- bash
- shell
- node sdk
export ACCESS_KEY=123...
curl -X POST \
-d "layout=auto" \
-d "voice_activation=true" \
"https://api.eyeson.team/rooms/$ACCESS_KEY/layout"
SET ACCESS_KEY=123...
curl -X POST ^
-d "layout=auto" ^
-d "voice_activation=true" "https://api.eyeson.team/rooms/%ACCESS_KEY%/layout"
This example also includes the creation of the room.
import Eyeson from 'eyeson-node';
const user_id_1 = 'abc...';
const eyeson = new Eyeson({ apiKey: 'API_KEY' });
const room = await eyeson.join('test-user-name', 'test-room', {
options: {
widescreen: true,
sfu_mode: 'disabled',
},
});
await room.waitReady();
console.log('Join via:', room.data.links.gui);
await room.setLayout({
layout: 'auto',
voice_activation: true,
});
This feature is only available if the layout is set to auto
.