awslabs / amazon-kinesis-video-streams-webrtc-sdk-android

Android SDK for interfacing with Amazon Kinesis Video Streams Signaling Service.
Apache License 2.0
58 stars 37 forks source link

Switch camera in android #63

Closed ghost closed 3 years ago

ghost commented 3 years ago

I'm aware this issue exists: https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-android/issues/38

But the answer doesn't solves the problem and is only suitable for web. I think a reset of the peer connection is too drastic just to switch the camera, there must be another option. Any hints on how to switch the camera while streaming in Android?

Thanks in advance

ghost commented 3 years ago

I found a way of switching the camera, just:

videoCapturer.dispose();
videoCapturer = createVideoCapturer();
videoCapturer.initialize(surfaceTextureHelper, this.getApplicationContext(), videoSource.getCapturerObserver());
videoCapturer.startCapture(VIDEO_SIZE_WIDTH, VIDEO_SIZE_HEIGHT, VIDEO_FPS);

Although it would be nice to have some kind of abstraction.