Closed jsfan3 closed 4 years ago
This Is weird..any screenshot? Does this issue occur on a specific device?Is the sample working properly? try AspectTextureView.MODE_INSIDE
Thank you for your reply.
I attach two screenshot. The following one is the desired result (obtained by a live streaming from my iPhone device to my Android device):
Instead this one is the stretched camera preview (obtained by a live streaming from my Android device using your library):
Said that, I've already tried AspectTextureView.MODE_INSIDE
, but it didn't solve.
Do you know Codename One? https://www.codenameone.com/ I'm using your library inside a Codename One application through a native interface: https://www.codenameone.com/blog/tutorial-native-interfaces.html
if MODE_INSIDE behaves exactly like MODE_FITXY,This may indicate that CodenameOne layout is different from android native layout Process. You can use the official TextureView,then manually adjust the view size to match the video ratio
Thanks for your suggestion. I solved the issue in this way:
In the Java file of Codename One, I made sure that the PeerComponent is always inserted in a Container with 9:16 proportions.
The PeerComponent mentioned in the previous point, returned from the Codename One's native interface, is an instance of AutoFitTextureView, whose source code can be found here: https://github.com/googlearchive/android-Camera2Basic/blob/master/Application/src/main/java/com/example/android/camera2basic/AutoFitTextureView.java
In the code reported at the beginning of this thread, I replaced AspectTextureView
with AutoFitTextureView
I changed the rendering mode to: resConfig.setRenderingMode(RESConfig.RenderingMode.NativeWindow);
I commented the line resConfig.setTargetVideoSize(new Size(720, 200));
-> In my case this line is not necessary, in fact, with Codename One it creates problems.
Finished, now it works correctly. I also tried streaming from one mobile phone to another and it's fine. Thanks again for this library.
Thank you for your so great library! It works fine, my only issue is that the camera preview in the
AspectTextureView
is stretched.I suspect that there is something simple in my code that I can fix, but I don't know what is wrong. Could you help me please? To be more clear: if
AspectTextureView
is square (width = height) the camera preview is correct, instead ifAspectTextureView
has full screen dimensions the camera preview is stretched. In both cases, however, the live streaming is broadcasted correctly, with the right proportion of width and height.I tried to change in several ways
resConfig.setTargetVideoSize(new Size(720, 480));
andtxv_preview.setAspectRatio(AspectTextureView.MODE_FITXY, ((double) s.getWidth()) / s.getHeight());
without solving this issue.Thank you for your support.
Relevant code: