How to control an IP camera from my Android Studio app

I'm building an Android Studio app that allows users to access an IP camera via a P2P connection. From reading Android Studio's MediaPlayer guide, I understand how to display a video feed from an external url. I'm wondering how I can add functionalities that allow the user to control the camera. The camera is a Foscam R2/R4 that comes with its own app. Through the app, you can receive motion and sound alerts and you can pan, tilt and zoom. I'm wondering how I can implement these features in my app. I found this guide on the Visualizer class, which I think I can use to detect sounds in the video feed, but I'm not sure how to detect motion or control the camera. Is there a way to do that?

Edit: I found this question where someone refers to this doc. It seems like this could be the solution to my question.