begeekmyfriend / yasea

RTMP live streaming client for Android
MIT License
4.86k stars 1.32k forks source link

You need to change the resolution on the fly #832

Open thegobot opened 2 years ago

thegobot commented 2 years ago

Please give advice

When changing cameras, the resolution does not change. It needs to be changed if the current resolution is not supported in the camera being changed. Otherwise the error Set parameters failed...

How can I change the resolution on the fly? No need to reconnect to the server.. What am I doing

mPublisher.stopEncode();
mPublisher.setPreviewResolution();
mPublisher.setOutputResolution()

mCameraView.setCameraId(0);
mEncoder.setCameraBackFace();

mPublisher.startEncode();
mPublisher.startCamera();

Yes, encoding continues, but players crash at this point in time. What else needs to be done to force the encoder to reconfigure correctly?

UPD: if you turn off audio and streaming only video, then there is no problem