Web Component#
OpenVidu Meet's Web Component allows embedding the refined, well-crafted OpenVidu Meet interface directly into your application. It offers attributes to customize the videoconferencing experience, exposes commands for programmatic control, and emits events for integration with your own application's logic.
Installation#
Include the following script in your HTML:
Usage#
Add the <openvidu-meet> tag to your HTML. This will embed OpenVidu Meet interface into your application:
One of room-url or recording-url is required: the former determines the room to access, the latter the recording to display. Different instances of the web component using the same room URL will join the same meeting.
A room URL is a room access link
The room URL is simply a room access link: the URL an individual opens to access a room. The role and identity a participant gets depend on which access link you use. This guide and most examples use the anonymous moderator/speaker links for simplicity, but a room also has user and identified-guest links — see Room Access for the full picture.
You can obtain a room's access links programmatically from your backend with the REST API: the access.anonymous.moderator.url, access.anonymous.speaker.url and access.user.url properties of the MeetRoom object, or the unique accessUrl of an identified-guest member.
Content Security Policy#
The Web Component runs in your page and opens its connections to OpenVidu Meet from it. If your page sets a Content Security Policy , allow the OpenVidu Meet origin in connect-src for HTTPS requests and for WebSocket too (wss://). The realtime connection of a participant waiting to be admitted uses the WebSocket one.
API Reference#
Attributes#
Declare attributes in the component to customize the meeting for your user.
| Attribute | Description | Required |
|---|---|---|
room-url |
The OpenVidu Meet room URL to access to. | Yes (This attribute is required unless recording-url is provided.) |
recording-url |
The URL of a recording to view. | Yes (This attribute is required unless room-url is provided.) |
participant-name |
Display name for the local participant. It fills and locks the join screen's name field, unless the participant is a room member or a signed-in user, whose own name is used instead. | No |
participant-external-id |
Identifier of the local participant in your own application, to correlate it with your users. Up to 64 characters (letters, digits, _ and -). Never interpreted by OpenVidu Meet. |
No |
participant-metadata |
Opaque application-defined payload attached to the local participant (JSON is recommended). Up to 2048 bytes (UTF-8). Never interpreted by OpenVidu Meet. | No |
initial-audio-active |
Join the meeting with the microphone active (true) or not (false). It overrides the room's config.initialAudioActive; if omitted, the room's value applies. The participant can change it afterwards, and a denied mediaPublishAudio permission always wins. |
No |
initial-video-active |
Join the meeting with the camera active (true) or not (false). It overrides the room's config.initialVideoActive; if omitted, the room's value applies. The participant can change it afterwards, and a denied mediaPublishVideo permission always wins. |
No |
language |
Language the interface starts in, on the meeting and recording screens alike: en, es, de, fr, zh (Simplified), hi, it, ja, nl or pt (European). A regional variant uses its language (pt-BR is pt). auto uses the browser's preferred languages, and English when none is available. It overrides the participant's previous choice, which they can still change unless show-language-selector is false. An unsupported value is ignored. |
No |
show-language-selector |
Show the language selectors (true by default). "false" hides them, so the participant cannot change the language. |
No |
e2ee-key |
Secret key for end-to-end encryption (E2EE). Used only in a room whose config.e2ee.enabled is true, where it fills the join screen's encryption key; ignored otherwise. |
No |
leave-redirect-url |
URL to redirect to when the participant dismisses the post-meeting, join, error or recording screen, or the end screen of a wait to join a locked room, right after the embeddedCloseRequested event fires. |
No |
show-only-recordings |
Show only the recordings instead of the live meeting. A bare attribute or any value other than "false" is true. |
No |
show-recording |
Identifier of the recording to display. When provided along with room-url, the app redirects to the recording view. |
No |
Example:
<openvidu-meet
room-url="{{ my-room-url }}"
participant-name="John Doe"
participant-external-id="user-42"
initial-video-active="false"
language="es"
leave-redirect-url="https://meeting.end.url/"
></openvidu-meet>
Identify your own users
participant-external-id and participant-metadata are never interpreted by OpenVidu Meet: they travel untouched as the externalId and metadata properties of every participant payload, in the participantJoined / participantLeft events and webhooks and in the Meetings REST API, so your backend can correlate a participant with one of its own users.
Commands#
The OpenVidu Meet component exposes a set of commands that allow you to control the room from your application's logic.
| Method | Description | Permission | Restriction |
|---|---|---|---|
|
Disconnects the local participant from the current meeting, or takes them out of the waiting room while they wait to be admitted. | None | Requires having joined the meeting |
|
Ends the current meeting for all participants. | meetingEnd |
Requires having joined the meeting |
|
Kicks a participant from the meeting. | participantKick |
Requires having joined the meeting |
|
Turns off a participant's microphone, camera or screen share. The participant may turn the device back on. | participantMute |
Requires having joined the meeting |
|
Turns off the microphone, camera or screen share of every participant except the moderators and the caller. Each participant may turn their devices back on. | participantMute |
Requires having joined the meeting |
|
Promotes a participant to moderator (upgrade) or returns a promoted one to their original role (downgrade). The participant is told through the participantRoleChanged event. |
participantPromote |
Requires having joined the meeting |
|
Raises the local participant's hand. Every participant is notified through the participantHandChanged event. Rejected while the room's raiseHand.enabled config is false. |
None | Requires having joined the meeting |
|
Lowers the local participant's hand, or another participant's when participantIdentity is given. Only lowering someone else's hand needs the permission. |
participantLowerHand |
Requires having joined the meeting |
|
Lowers every raised hand in the meeting. | participantLowerHand |
Requires having joined the meeting |
|
Admits the waiting participant participantIdentity, if a place is free. |
waitingParticipantAdmin |
Requires having joined the meeting |
|
Admits everyone waiting, or nobody when they outnumber the free places. | waitingParticipantAdmin |
Requires having joined the meeting |
|
Rejects the waiting participant participantIdentity, who may ask to join again. |
waitingParticipantAdmin |
Requires having joined the meeting |
|
Rejects everyone the meeting shows waiting. Those who stopped waiting meanwhile are not an error. | waitingParticipantAdmin |
Requires having joined the meeting |
|
Sends a reaction from the local participant, which every participant sees for a few seconds and is notified of through the participantReactionSent event. |
participantSendReaction |
Requires having joined the meeting |
|
Toggles the local participant's microphone, or sets it when active is provided. |
mediaPublishAudio |
Requires the prejoin screen or an ongoing meeting |
|
Toggles the local participant's camera, or sets it when active is provided. |
mediaPublishVideo |
Requires the prejoin screen or an ongoing meeting |
|
Toggles the local participant's screen share, or sets it when active is provided. |
mediaShareScreen |
Requires having joined the meeting |
|
Starts recording the meeting. Its progress is reported by the recordingStarted, recordingUpdated and recordingEnded events. |
recordingControl |
Requires having joined the meeting |
|
Stops the recording in progress. | recordingControl |
Requires having joined the meeting |
|
Starts a live broadcast of the meeting to each of the given destinations, one broadcast per destination: the room destinations named by destinationIds, or, when it is omitted, each room destination not being streamed to yet, plus the destinations given by name and URL for this meeting only, which also need broadcastEdit. The room must have live broadcast enabled. |
broadcastControl |
Requires having joined the meeting |
|
Stops the live broadcast of the meeting named by broadcastId. |
broadcastControl |
Requires having joined the meeting |
|
Stops the live broadcasts of the current meeting that are running when it is called. | broadcastControl |
Requires having joined the meeting |
|
Deprecated Renamed to meetingEnd. Removed in 3.12.0. |
meetingEnd |
Requires having joined the meeting |
|
Deprecated Renamed to meetingLeave. Removed in 3.12.0. |
None | Requires having joined the meeting |
|
Deprecated Renamed to participantKick. Removed in 3.12.0. |
participantKick |
Requires having joined the meeting |
Invoke commands using JavaScript:
Commands that take parameters receive them as arguments, in the order listed in the table:
openviduMeet.participantMute('participant-identity', { audioActive: false });
openviduMeet.mediaToggleVideo(false);
Events#
The OpenVidu Meet component emits events that you can listen to in your application.
| Event | Description | Payload |
|---|---|---|
meetingJoined |
Event emitted when the local participant joins the meeting. | |
meetingLeft |
Event emitted when the local participant leaves the meeting. | |
participantJoined |
Event emitted when a remote participant joins the meeting. Only live transitions are notified: participants already in the meeting when the local one joins are not replayed. The local participant's own join is notified through meetingJoined instead. |
|
participantLeft |
Event emitted when a remote participant leaves the meeting. The local participant's own departure is notified through meetingLeft instead. |
|
participantRoleChanged |
Event emitted to the local participant when they are promoted to moderator or returned to their original role, once the permissions of the new role are in effect. A change made while the participant is still joining is reported after meetingJoined. The other participants are not notified. |
|
waitingParticipantKnocked |
Event emitted to the participants in the meeting holding waitingParticipantAdmin when a participant asks to join a locked room. Those already waiting on joining, and those waiting again after a failed admission, come only in waitingParticipantListUpdated. |
|
waitingParticipantListUpdated |
Event emitted to the participants in the meeting holding waitingParticipantAdmin with the whole waiting list of a locked room: on joining, on gaining the permission, and on every change. |
|
waitingParticipantStatusChanged |
Event emitted when a wait to join a locked room changes status: to the waiting participant for their own wait, and to the participants in the meeting holding waitingParticipantAdmin for every wait of the room. |
|
participantHandChanged |
Event emitted to every participant when a participant's hand is raised or lowered, by themselves or by a moderator. A participant joining a meeting with raised hands receives one event per raised hand, in queue order, right after meetingJoined. The queue is ordered by participant.handRaiseDate. |
|
participantReactionSent |
Event emitted to every participant, the sender included, when a participant sends a reaction. Reactions are not replayed: a participant joining later is not notified of the ones sent before. | |
mediaAudioStatusChanged |
Event emitted to the local participant when their microphone state changes. Emitted from the prejoin screen onwards, before meetingJoined, and also on the waiting screen. |
|
mediaVideoStatusChanged |
Event emitted to the local participant when their camera state changes. Emitted from the prejoin screen onwards, before meetingJoined, and also on the waiting screen. |
|
mediaScreenShareStatusChanged |
Event emitted to the local participant when their screen share starts or stops, once the meeting is joined. | |
recordingStarted |
Event emitted to every participant when a recording of the meeting starts, whoever started it. A participant who joins while the meeting is being recorded receives it on joining, right after meetingJoined, so the host can always show that the meeting is being recorded. |
|
recordingUpdated |
Event emitted to every participant when a recording in progress changes, for example when it goes active once media is being recorded, or starts ending. | |
recordingEnded |
Event emitted to every participant when a recording of the meeting ends, normally or because it failed. | |
broadcastStarted |
Event emitted to every participant when a live broadcast of the meeting starts, one per destination. A participant who joins while broadcasts are running receives one event per running broadcast on joining, so the host can always show that the meeting is being streamed. | |
broadcastUpdated |
Event emitted to every participant when a running broadcast changes, for example when it goes active once media reaches its destination, or starts ending. | |
broadcastEnded |
Event emitted to every participant when a live broadcast of the meeting ends, normally or because it failed. | |
embeddedCloseRequested |
Event emitted when the participant asks to close OpenVidu Meet by dismissing the post-meeting, join, error or recording screen. The host application responds by removing the embedded element or routing the participant elsewhere; the meeting itself may still be running for the other participants. | - |
joined |
Deprecated Renamed to meetingJoined. Removed in 3.12.0. |
|
left |
Deprecated Renamed to meetingLeft. Removed in 3.12.0. |
|
closed |
Deprecated Renamed to embeddedCloseRequested. Removed in 3.12.0. |
- |
Listen to events using JavaScript event listeners:
const openviduMeet = document.querySelector('openvidu-meet');
openviduMeet.addEventListener('meetingJoined', (event) => {
console.log('The local participant has joined the meeting', event.detail);
});
You can also use the API on | once | off:
const openviduMeet = document.querySelector('openvidu-meet');
openviduMeet.on('meetingJoined', (event) => {
console.log('The local participant has joined the meeting', event);
});
openviduMeet.on('participantJoined', (event) => {
console.log(`${event.participant.participantName} has joined the meeting`, event);
});
openviduMeet.once('meetingLeft', (event) => {
console.log('The local participant has left the meeting', event.reason);
});
Accessing the event payload
The way you access the event payload depends on the method you use to listen:
- With the native
addEventListenermethod, the callback receives a standardCustomEvent, so the payload is available in itsdetailproperty (e.g.event.detail). - With the
on|once|offAPI, the callback receives the payload directly as its argument (e.g.event), without needing to access anydetailproperty.
When the participant asks to close OpenVidu Meet, the component emits embeddedCloseRequested: that is the moment to remove it or show one of your own screens. Leaving the meeting does not emit it: meetingLeft fires and OpenVidu Meet shows its End view, and embeddedCloseRequested follows when the participant closes that view. The meeting may still be running for everyone else.