Is it possible to change lottie resolution according to internet speeed


I am using a fullscreen Lottie on my webpage, so it is a bit heavy (20 mb). I also have a smaller size of the Lottie with lower res, is there any way to change the resolution of the Lottie according to the internet speed?