kclyu / rpi-webrtc-streamer

This repo's objective is providing something like Web Cam server on the most popular Raspberry PI hardware. By integrating [WebRTC](https://webrtc.org/native-code/) and Raspberry PI, we can stream the Raspberry camera feed to browser or native client which talks WebRTC.
Other
617 stars 108 forks source link

Capture Video Stream Using Spring-boot Websocket Java Client #118

Open ms82389157 opened 3 years ago

ms82389157 commented 3 years ago

Hi,

I am trying to create a websocket java client using spring boot to capture the video stream from the Pi machine. The purpose is to capture video and send email notifications from a central service on a linux server.

I have a Spring boot application using spring-websockets. I have a socket handler that overrides various methods including handleTextMessage, etc. From what I can tell, I am able to replicate all the text message calls that http://your-raspberry-pi-ipaddress:8889/np2/ makes to the Pi machine. I have compared the logs generate on the Pi rpi-webrtc-streamer service web page and from my spring boot app using web-sockets and they are identical. However, I do not know how to receive/capture the video stream. I thought I could capture the video by using handleBinaryMessage but that is only for sending/receiving files not streaming. I am new to webrtc/web-sockets so I do not know how to do this.

I have searched but have not been able to find any examples on how to receive the video stream in a spring web-sockets java client and process a frame or save to a file on the Linux server. I want the solution to be pure java not JavaScript.

I am thinking that I need to take the received textmessage with cmd: send and msg{ "sdp" or the candidate and somehow use this info to grab the stream

Any help would be greatly appreciated.