13 Commits

Author SHA1 Message Date
Kamil Trzciński
2d3a488437 webrtc: add ping/pong when sending a frame 2025-07-03 00:07:59 +02:00
Joshua Piccari
e4fe25fdb6 webrtc: add liveness check to WebRTC output using data channel
Previously, there was no way to detect if WebRTC clients were still
connected to the stream. This lead to the RTC streams being kept
open indefinitely when clients focibly closed the stream. This can
happen with Chrome, Edge, Safari, etc when the tab is closed or on
mobile devices when the screen is locked or browser closed.

This change adds a data channel to the stream and requires users to
respond to ping requests. While sending a frame the ping might be
sent to the client. If clients do not respond to these ping requests before
the timeout duration the stream is closed and the client is removed
from the server. This causes the client to reinitiate the connection.

The timeout defaults to 30 seconds.

The client needs to send `keepAlive: true` as part of webrtc request.
On the received `ping` send back the `pong` over data-channel.
2025-07-03 00:07:59 +02:00
Kamil Trzcinski
01b0e969b3 webrtc: always use iceServers instead of ice_servers 2023-06-14 00:18:56 +02:00
Kamil Trzcinski
272b16ee1c webrtc: accept iceServers: [] provided in POST /webrtc, support trickle ICE
Thanks https://github.com/ayufan/camera-streamer/pull/65
2023-06-13 20:35:48 +02:00
Kamil Trzcinski
e8ffe47343 webrtc: allow to specify ice-servers on command line 2023-06-13 20:35:44 +02:00
Kamil Trzcinski
60f7aa1ceb webrtc: ensure that keyframe is requested at start of stream 2023-03-08 19:37:28 +01:00
Kamil Trzcinski
e4d5986e99 webrtc: request keyframe exactly once 2023-02-24 22:20:36 +01:00
Kamil Trzcinski
b2dfba5577 cmd: add /status.json to describe what and how it works 2023-02-22 21:40:17 +01:00
Kamil Trzciński
ca08adb62f Add -snapshot.height, -stream.height and -video.height 2023-02-22 17:32:46 +01:00
Kamil Trzciński
79e9bca11f Discover H264 keyframes on dequeue 2022-10-29 11:36:58 +02:00
Kamil Trzcinski
57fc761986 Active high/low res only when needed 2022-10-25 16:56:32 +02:00
MK3S+ Printer
e509c328f1 Disable usage of STUN server (it should not be needed for local) 2022-10-10 20:27:22 +02:00
Kamil Trzcinski
5ee0bee59f Add WebRTC support using libdatachannel
The WebRTC is exposed via `/video.html` endpoint
and enabled by default as long as h264 stream
is available.
2022-09-24 10:38:37 +02:00