GetStream / webrtc-android

🛰️ A versatile WebRTC pre-compiled Android library that reflects the recent WebRTC updates to facilitate real-time video chat for Android and Compose.
https://getstream.github.io/webrtc-android/
Apache License 2.0
597 stars 72 forks source link

CameraVideoCapturer add change mirror mode method and fix default fro… #192

Closed Tans5 closed 2 months ago

Tans5 commented 2 months ago

…nt camera wrong mirror state.

🎯 Goal

Default front camera mirror state is wrong and I add a method to change mirror mode.

🛠 Implementation details

Add CameraVideoCapturer#mirrorCamera() to change camera mirror state and remove default front camera use mirror mode.
Add CameraVideoCapturer#isMirrorCamera() to check camera mirror state.
Add CameraVideoCapturer#isUsingFrontCamera() to check if using front camera.

✍️ Explain examples

val videoCapture = Camera2Capturer(context, targetIds ?: ids.firstOrNull(), null)
// make camera mirror
videoCapture.mirrorCamera(true)

Preparing a pull request for review

Ensure your change is properly formatted by running:

$ ./gradlew spotlessApply

Please correct any failures before requesting a review.

Tans5 commented 2 months ago

Looks good to me! Would you mirror this PR on this Getstream/webrtc repository as well? Because this library is built top of that repository.

I'm not good at C++, so it's too difficult for me.

skydoves commented 2 months ago

I mean that project also mirrors that WebRTC Java files: https://github.com/GetStream/webrtc/blob/05c2ec7e1b74e9ed1875cc32833cae835bf64d2d/sdk/android/src/java/org/webrtc/Camera1Session.java#L4

Tans5 commented 2 months ago

OK, I will do it. 😂

Tans5 commented 2 months ago

https://github.com/GetStream/webrtc/pull/38