not sure if you mentioned this before, but do you use h.265 codecs?
issue seems known:
https://supportcommunity.milestonesys.com/s/article/Mobile-and-Web-client-connection-lost-on-h-265-cameras-troubleshooting?language=en_US
firstly, dont forget time synchronization and
Try downloading the Onvif Device Manager and see if this connects well.
if so, push it manually to the Onvif driver and it should run.