You can run something like Spydroid or "IPCam demo" from the fdroid store, to turn a phone into an IP webcam. I used an old Moto Z with LineageOS as a webcam for a while there, against a linux host.
Took a bunch of messing around, but it worked well.
Took a bunch of messing around, but it worked well.