Switch Template
This guide demonstrates how to dynamically switch meeting room layout templates in an Arctos meeting room. You can change between different predefined layouts and control synchronization behavior.
Prerequisites
Before implementing template switching, ensure you have:
- Arctos SDK properly loaded
- Meeting room initialized
- Appropriate user permissions
Step 1: Initialize Arctos Instance
First initialize an Arctos Instance.
// wait for arctos-widget.js to load
window.addEventListener('ArctosLoad', async function (e) {
arctosSdkInstance = new Arctos({
endpointUrl: ENDPOINTURL,
endpointKey: ENDPOINTKEY,
});
// Be careful !!!, the following code is for testing only. You should store the license key in your server side.
const authCode = await getAuthCode();
// Retrieve the user token.
const accessToken = await getAuthToken(authCode);
// 初始化連線
await arctosSdkInstance.initSession({
accessToken: accessToken,
sessionId: TASKNUM,
});
// 初始化會議室
await arctosSdkInstance.initMeetingRoom({
isDebug: false,
recordingAutoStart: false,
showPrejoin: true,
showToolbar: true,
});
});
Step 2: Implement Template Switching
Template Switching with Synchronization
Control whether template changes are synchronized across all participants:
let isSynchronous = false;
// Toggle synchronization mode
switchSynchronous = async function () {
isSynchronous = !isSynchronous;
// Update UI to reflect current state
let target = document.querySelector('.syncBtn');
target.classList.toggle('active', isSynchronous);
};
// Switch template with synchronization control
switchTemplateChange = async function () {
let str = document.querySelector('#switch-camera-resolution').value;
arctosSdkInstance.$meetingRoom.setTemplate(str, isSynchronous);
};
Step 3: Available Templates
The following templates are available by default:
| Template Name | Description | Special Features |
|---|---|---|
default | Basic layout template | Standard participant arrangement |
template-1 | Grid layout with equal participant windows | Balanced view for all participants |
template-2 | Speaker focus layout with thumbnails | Emphasizes active speaker |
template-3 | Presentation layout with shared content focus | Optimized for content sharing |
template-4 | Gallery view with multiple participants | Multi-participant display |
template-5 | Advanced layout template | Enhanced viewing options |
share-1 | content sharing layout | Basic screen sharing mode |
share-2 | content sharing layout | 4-participant grid with sharing (grid-layout-4p) |
share-3 | content sharing layout | 8-participant grid with sharing (grid-layout-8p) |
canvas-1 | Canvas-based layout | Interactive whiteboard support |
Special Layout Features
- share-2 and share-3 templates include a "其他參與者" (Other Participants) button when there are hidden participants
- Grid layouts: share-2 uses 4-participant grid, share-3 uses 8-participant grid
- Participant management: Templates automatically handle participant visibility and overflow
The following url is a sample code for template switching.
