Camera Controls - Flutter
Whenever any participant wants to start/stop broadcasting their video to other participant in a room, they can simply do it with VideoSDK Room.
This guide will provide an overview of how to implement enable, disable and switch camera features in a room.
- Enable Camera - By using
enableCam()
function, a participant can publish camera stream to other participants. - Disable Camera - By using
disableCam()
function, a participant can stop publishing camera stream to other participants. - Switch Camera - By using
changeCam()
function, a participant can stream from front / rear camera during the room.This function is only applicable for Mobile devices.
Enable, Disable And Switch Camera​
ElevatedButton(
onPressed: room.disableCam,
child: Text("disable camera"),
),
ElevatedButton(
onPressed: room.enableCam,
child: Text("enable camera"),
),
ElevatedButton(
onPressed: () {
room.changeCam("<device>")
},
child: Text("changeCam"),
),
Events​
Events associated with enableWebcam()
:
streamEnabled
event will be emitted withstream
object from the event callback, inside that participant object.
Events associated with disableWebcam()
:
streamDisabled
event will be emitted withstream
object from the event callback, inside that participant object.
participant.on(Events.streamEnabled, (Stream stream){
if (stream.kind === "video") {
//particiapnt turned on video
//Render Participant video logic here
}
});
participant.on(Events.streamDisabled, (Stream stream){
if (stream.kind === "video") {
//particiapnt turned off video
//remove Participant video logic here
}
});
Got a Question? Ask us on discord