At the moment, the container comes up and sits publishing media.
Strictly speaking, that's not the most efficient thing to do.
What I'd quite like, assuming that we can get it to work is:
nginx-rtmp
on-play
hook(s) call it when a subscriber connectssomething
to trigger playback
Activity
04-Aug-24 08:51
assigned to @btasker
04-Aug-24 08:53
At it's simplest, this could be a small Flask script which touches a file on disk.
stream_video.sh
would then check for existence of that file.If the file exists, rather than playing media, it'd need to loop checking periodically (I guess it'd have to be once a second - we don't want to introduce too long a startup delay).
Because there'd be a delay, we probably need to look at tuning the HLS settings to help minimise the impact
04-Aug-24 09:46
Looks like the container already has python in, so it probably makes as much sense to use that over anything else.
04-Aug-24 10:09
mentioned in commit github-mirror/Home-TV-Station@803ae1bd69c75ed16cde991c63fadaa0c3edddc5
Message
feat: cobble together a small control server for playback hooks (project-management-only/home-tv-station#11)
04-Aug-24 10:43
mentioned in commit github-mirror/Home-TV-Station@d5a03f9bff9516ce4edba0c2f4e5d8778c40a1ce
Message
feat: implement control process so publishing only triggers if there are subscribers (project-management-only/home-tv-station#11)
04-Aug-24 10:46
The logic for this is now in place, but disabled by default.
To enable, set
CONTROL_FILES_ENABLED
totrue
.Then:
ffmpeg
publishing will not begin unless there's at least one subscriber connectedHowever, this can only ever work with RTMP. There isn't a callback available for HLS playback, so it's not possible to do the same.
Under the hood, the control stack writes files into
/tmp/control
to track state and player count.