Artem Kopan

09/06/2020, 9:51 AM
How to check if value was changed by user or not in Slider? I need to handle start and end event

Timo Drick

09/06/2020, 10:20 AM
Not sure if i understood the question correct. But the onValueChange callback will tell you that the user changed the slider position. There is also a onValueChangeEnd callback.

Artem Kopan

09/06/2020, 11:25 AM
I wanna make something like seekbar. As I understood, the analog of seekbar is Slider. It will be nice to understand how to handle onValueChange from user actions. I’m trying to implement media player and there are two sources of slider value: from the player or from the user (while seeking)
I would recommend to update just the state variable in the onValueChange callback. And when you get the onValueChangeEnd callback you seek your player to the correct position. Also you need to update the state when your players position changed. (Hmm yea i think now i understand why you need to get the on start also)
So maybe you have to implement a state on your own to keep track if the user is sliding. You could set this state variable to true on the onValueChange callback and to false in the onValueChangeEnd event. Than you know if you should update the slider position according to the player position