-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zoomable android #9
Conversation
Restructured it a bit. The GestureConfig: Also, not sure if theres a better way to define the GestureConfig class & the sub classes for each gesture, in kotlin. Tested the example app on: |
Hi, Nice :) Just sharing my reflexions at the moment:
Wdyt? |
I think you are right. Havent thought about the user setting Taking a look at the different camera apps (Snapchat, TikTok & Instagram), double tap is the default gesture for switching the camera facing. So this is probably what most end users are used to. Zoom with StreamPack, you can literally zoom out of the app (It crashes). Setting the zoom factor to a high number will make it zooom fast. Not sure if it is the speed of the zoom that crashes the app, or if it is the high zoom ratio. Not sure if i have buthered the terminology yet, or mixed something up yet. .... Of course, the more functionality that is being added. The more can go wrong, and has to be maintained. The more i think about it, it does seem like, from what i have made it does seem like an enforcement of how the broadcaster should work. I do believe i am biased. Depending on what you want, i can move it to the RN package. Double click is not necessary, it was easy, that is the only reason i added it. |
Hi, The libraries will have a With StreamPack, you will have to clamp zoom ratio with About the switch camera on double tap, we will drop it for now. It is a specific behaviour that user might not need. So the part about the If you grant me the access to your libraries. I can help :) |
Invited you to the repositories. Gonna do Android first. |
I was trying to clamp value with Range in StreamPack, I have tested to set zoom outside of |
Ok, for clamp in StreamPack, see ThibaultBee/StreamPack@f13a0e4 |
Everything should be removed again, but keeping the zoomRatio. Btw, i added a sdk version check when setting zoomRatio. The one i did Running on android 11, sdk 30. When zooming the preview crashes. Not the app. |
Also added support Zoom on device with Android < R (see ThibaultBee/StreamPack@67c735e) So with the future version of StreamPack (to be released):
And it might be useful to return the supported zoom range. Right? Don't worry, I will handle this. |
Cool, ill adjust it to your remarks. Yes that would be useful to expose the supported zoom range. But in that case. Couldnt it be useful to make |
Alright, everything should be ready both here. Not sure if you wanted me to do anything else from your last message. Ill start on React Native now. |
api.video android live stream is a wrapper around a RTMP live streaming client. The purpose is to simplify the usage of a RTMP live streaming client. Moreover, we are using StreamPack as a RTMP live streaming client but we might want to change it if it is not good enough or if we find a better RTMP client. So, we don't want to expose RTMP client specific API. I will make small changes on your commit. You don't have to do anything! |
Alright, understood. |
Perfect 👍 Great job! Thank you :) I will merge after StreamPack release. |
Dont worry, we got there at the end. I dont have anything to add, it looks good. The iOS pr is ready with the same changes as we have here. ZoomRatio & example zoom. |
Issue
Generally missing a zoom functionality.
Mentioned in:
apivideo/api.video-reactnative-live-stream#9
Description of the Change
Added a zoomRatio property which is a proxy for
streamer.settings.camera.zoom.zoomRatio
Added a pinchGestureEnabled which will set
setOnTouchListener
on the preview (apiVideoView
)If
pinchGestureEnabled
is set to TRUE it will setsetOnTouchListener
to thepinchGesture
which handles the pinch input and translates it tozoomRatio
.If
pinchGestureEnabled
is set to FALSE it will setsetOnTouchListener
to null meaning it is no longer using thepinchGesture
Both
zoomRatio
&pinchGestureEnabled
should be public and can be set by the user of this package.Possible Drawbacks
I am really still not sold by the structure of enabling and disabling the pinch gesture.
pinchGestureEnabled
would have to be set to true in the initialize, but if the user of the package dont want to enable it, they would have to disable it in their initialize.And aswell the other way around, it its by default turned off.
Possible solution for this, could be if somehow we can call the
set
part ofzoomRatio
when the surface is created or something like that.Another could be to take a
initialFeatureConfig
like theaudio/videoConfig
, and in that feature config we would have if the gestures should be enabled by default. This would callset
onzoomRatio
in the constructor.From apivideo/api.video-swift-live-stream#8
Some people might get confused. With React Native, if you draw a View with Position: "Absolute" over the preview. That View would capture all of the click events. So you will need to add
pointerEvents="none"
to the view stretching over the preview to make touches go through that view.Verification Process
Tested in development mode with the example app.
Huawei P20 Lite (Android 9): was expected to fail as it has not received updates since android 9. It does not crash when trying to zoom. But it does crash when trying to enter the settings page.
Nokia T20 (Android 11): was expected to work seeing as it is running sdk 30. But it crashes immediately when
zoomRatio
is set.Samsung A22 (Android 11 & 12): Worked well on both version 11 & 12 without any problems.
Tho the zooming itself felt slow. Pinching in and out (consistently in a slightly speeded up speed from what you normally would expect) for a little while can desync your gesture from the zoom happening on screen, as if the phone cant catch up.
Comment
I am only able to test on Android 12, since i have updated both Samsung A22 to Android 12. These are the only phones i have in office fit for testing this feature.
When setting the
zoomRatio
we should check for system sdk - and also check before enabling the pinch gesture.This is a draft.