Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

switch camera(back/front) in android webrtc

I have used libjingle library for webrtc android application. I have successfully implemented audio video streaming for two way communication.

Till now i was using front camera for video streaming but now i want to put option for users to select front or back camera for video streaming.

How can i archive it? i have no idea about this.

I have tried VideocaptureAndroid switch camera method but not working.

If anyone one knows then help me out for this functionality?

Thanks in advance.

like image 577
adit microsys Avatar asked Jan 31 '26 12:01

adit microsys


1 Answers

You need to use the same videoCapturer object, which is created while initial MediaStream creation.

CameraVideoCapturer cameraVideoCapturer = (CameraVideoCapturer) videoCapturer;
cameraVideoCapturer.switchCamera(null);

AppRTC Reference

like image 138
Ajay Avatar answered Feb 02 '26 01:02

Ajay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!