AlexxIT / WebRTC

Home Assistant custom component for real-time viewing of almost any camera stream using WebRTC and other technologies.
https://github.com/AlexxIT/Blog
MIT License
1.52k stars 180 forks source link

Live video indicator #492

Open dbuezas opened 1 year ago

dbuezas commented 1 year ago

One of my cameras will some times stop working for a couple of minutes, and this means I can't trust the image is live.

I'd really like to have an option to enable a blinking red dot or similar to indicate the video is running.

dbuezas commented 1 year ago

I just realised the timeupdate event may be perfect for exactly that.

// something like this:
videoElement.addEventListener("timeupdate", (event) => {
    const redDotVisible = Math.round(video.currentTime)%2;
    console.log(redDotVisible);
});

I'll make a PR later this week :)

dbuezas commented 1 year ago

Something like this: Kapture 2023-05-23 at 22 52 07

Although maybe it is better to show a big loading indicator when the video stops updating instead? (blinking dot means video is getting updates)

Do you have any preference?

dbuezas commented 1 year ago

I accidentally lost the code (it wasn't much) when I upgraded webrtc. @AlexxIT I am not sure this is a "good" feature, maybe the loading indicator should be shown instead, or the connection should be watched and force reconnect. In any case, I can look into this if you think there is any value on this. Otherwise I won't, as I ended up fixing my flaky cameras by adding #async to all affected streams