Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there an url to access the stream directly? #52

Open
SnShine opened this issue Nov 16, 2020 · 1 comment
Open

Is there an url to access the stream directly? #52

SnShine opened this issue Nov 16, 2020 · 1 comment

Comments

@SnShine
Copy link

SnShine commented Nov 16, 2020

In web_video_server you have an option to directly access the stream via an url - https://github.com/RobotWebTools/web_video_server. But here it seems there is no provision for that feature. Only have an html page.

Is there any easier way to access the stream via url?

@roehling
Copy link
Collaborator

There is no static URL you could access, because WebRTC is not just a one-way streaming protocol but a full-blown peer-to-peer communication suite with several different protocols as parts. Significant portions are actually implemented in the browser itself. The important bits can be found in webrtc_ros.js.

The browser provides an RTCPeerConnection class that handles the low-level streaming. The client code and the server will exchange a few JSON-encoded messages via a WebSockets connection, mostly to figure out which ROS image topic shall be streamed. The actual message format doesn't really matter, it's just an invented protocol to exchange all information which is required by the RTCPeerConnection. The server will create a new session, add the requested video stream to it, and send the details to the browser, this time in a standardized format called Session Description Protocol or SDP. The RTCPeerConnection class can parse the SDP format and connect to the stream.

In the viewer.js, the stream is connected to a video HTML element. The video element (again implemented by the browser), knows how to decode and display the stream. The stream itself is pretty much a standard RTP connection.

There are a few complications in the initial message exchange, primarily to deal with firewalls or computers behind a router without their own public IP. But that's WebRTC in a nutshell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants