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.53k stars 180 forks source link

PTZ controls per stream #749

Closed didster closed 1 month ago

didster commented 1 month ago

I'm trying to figure out the best way to have multiple cameras shown on a dashboard using WebRTC card. Obviously multiple cards works fine but takes a lot of space. I tried using swiper-card to host the cards within a single swiper element and that sort of works but the PTZ controls don't work within the swiper and more importantly 50% of the time the swiper doesn't even load. Since that card seems abandoned not updated since 2022 I am looking for alternatives.

Using a single WebRTC card with each camera as a defined stream works great. But my trouble now is all the cameras have PTZ enabled within the card and that config is global to the card itself, not per stream, so I can only configure one of the three cameras PTZ controls to work. Is it possible to either:

a) Some how get the active stream name from the configuration so I can pass this to a script and use it to trigger the correct PTZ action b) Configure PTZ controls in place per-stream?

Thanks

AlexxIT commented 1 month ago

I don't like the idea of complicating the logic of this card with linking PTZ settings to streams. Better look for some custom card that can switch multiple WebRTC cards in one place.

didster commented 1 month ago

Understood. I have tried several and none of them work very well sadly. They either block the ptz controls all together or in the case of custom swipe card seem so buggy and don't load half the time. But I understand your decision. Could you just confirm for me if there is any way at all I could get the active stream name in yaml in a way I could pass it to a service?

AlexxIT commented 1 month ago

I'll think about what I can do

didster commented 1 month ago

Ok thank you!

One idea might be to add configuration for a helper name to the stream section

stream_storage: my_helper

And when given, have the card write to that helper the name of the stream when it changes. Then the helper name could then be easily passed to a script and read from there. As an added bonus it could also be used so the card itself could automatically switch to the last active stream when reloaded.

Just a thought

AlexxIT commented 1 month ago

I think your problem solved https://github.com/AlexxIT/WebRTC?tab=readme-ov-file#templates