Skip to main content
Version: 1.2.x

Join Meeting - Flutter

Overview

Before joining the meeting, it has to be initialized. If you have not initialized a meeting/room yet, you can follow the guide here.

join()

  • To join the meeting you can call the join() on the created Room object.
import 'package:flutter/material.dart';
import 'package:videosdk/videosdk.dart';

class MeetingScreen extends StatefulWidget {
...
}

class _MeetingScreenState extends State<MeetingScreen> {
late Room _room;

@override
void initState() {
//Creating a new Room based on the passed meetingId and token from the Joining Screen
// create room
_room = VideoSDK.createRoom(
roomId: widget.meetingId,
token: widget.token,
displayName: "John Doe",
micEnabled: true,
camEnabled: true,
defaultCameraIndex:
1, // Index of MediaDevices will be used to set default camera
);

//Calling Join after the room object is created
_room.join()

super.initState();
}

@override
Widget build(BuildContext context) {
return YourMeetingWidget();
}
}

Events associated with Join

Following callbacks are received when a participant is successfully joined.

import 'package:flutter/material.dart';
import 'package:videosdk/videosdk.dart';

class MeetingScreen extends StatefulWidget {
...
}

class _MeetingScreenState extends State<MeetingScreen> {
late Room _room;

@override
void initState() {
...

setupRoomEventListener();
}

@override
Widget build(BuildContext context) {
return YourMeetingWidget();
}

void setupRoomEventListener() {
room.on(Events.roomJoined, (){
// Room/Meeting joined Successfully
});
room.on(Events.participantJoined, (Participant participant){
// New Participant joined the meeting
});
}
}

API Reference

The API references for all the methods and events utilized in this guide are provided below.

Got a Question? Ask us on discord