After looking through the OctoPrint forum I saw that some people had used a special firmware on Wyze cameras to just make them into webcameras and connect directly to the Raspberry. The Wyze camera and the XiaoFang are the same camera, but wonder if it would just work to use that firmware? Found an article indicating it should work so gave it a try. Went to the firmware page and followed the instructions. Built a USB A to USB A cable and connected the camera to my PC. Wow, it is a webcam! Connected it the the Raspberry and entered the default settings for camera. Voila!
I wanted to have a live video stream from my Snapmaker 2.0 since it now has got a space in a closet. After a couple of tries to use a live video stream from the XiaoFang camera I realized it would not be a good solution. Quite a lot of tweaking to get it to work and it would require quite some resources from the Raspberry and thus might affect prints. But I still wanted to use that camera since I already had it.