home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
3.96k stars 2.69k forks source link

WebRTC camera entities do not display when navigating away from the page and returning #11540

Closed ronaldheft closed 2 years ago

ronaldheft commented 2 years ago

The problem

If I load up a page that has a camera entity using WebRTC, I click on another lovelace page, and then navigate back to the original page, the camera entity does not load when returning to the page and remains a black box.

If I start on a lovelace page that does not have a camera entity and then navigate to the page with a camera entity, it displays fine the first time.

The issue appears when returning to pages that have already displayed WebRTC camera entities. I have been able to reproduce this in both Safari and Chrome on Mac.

What version of Home Assistant Core has the issue?

core-2022.2.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

rtsp_to_webrtc

Link to integration documentation on our website

https://www.home-assistant.io/integrations/rtsp_to_webrtc

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Nothing shows for the WebRTC component.

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

rtsp_to_webrtc documentation rtsp_to_webrtc source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @allenporter, mind taking a look at this issue as it has been labeled with an integration (rtsp_to_webrtc) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

sumur1au commented 2 years ago

I have same issue on Chrome on Mobile and Desktop. Also raised in the forums.
https://community.home-assistant.io/t/add-on-rtsptoweb-and-rtsptowebrtc/387846/32

allenporter commented 2 years ago

Thanks for the report. This sounds like an issue with the frontend, so we may need to move this between components.

Can you describe in more detail about the exact lovelace card configurations being used, etc? I'm not able to reproduce this, but definitely could believe there is a bug here.

ronaldheft commented 2 years ago

@allenporter

Sure, here is my card configuration. I'm using just a standard picture-glance card.

type: picture-glance
title: Driveway
camera_image: camera.driveway_rtsp
camera_view: live
aspect_ratio: "16:9"
entities:
  - entity: binary_sensor.camera_static_last_snapshot
    attribute: last_changed
    show_state: true
tap_action:
  action: url
  url_path: "synocam://"

The card is a descendent of a grid card, which is a descendent of a vertical-stack, if that ends up mattering.

jdehlin commented 2 years ago

I'm having the same issue using the picture glance card as well as with the Frigate card.

allenporter commented 2 years ago

I have not been able to reproduce this.

jdehlin commented 2 years ago

I'm on HA 2022.2.7 and RTSPtoWeb - WebRTC add-on 1.0.1 plus the integration. When initially navigating to the dashboard the streams load. Navigating between tabs within the dashboard results in the stream being unloaded and not reloaded when returning to the tab with the stream.

Please let me know if there's any other information or diagnostics I can provide.

jdehlin commented 2 years ago

Here's a screencast of the issue as well: https://user-images.githubusercontent.com/49238/154362013-f679d5ff-0207-4cda-b622-bc112e5453f2.mp4

allenporter commented 2 years ago

I was able to reproduce this. Do you notice a behavior change when omitting camera_view: live? Overall it seems like the UI acts really strange with that value, like doesn't show the Save dialog when you change the drop down, and it does not seem to persist the values into .yaml from the UI.

jdehlin commented 2 years ago

No, the static image is shown when switching back from another tab, but the goal is for the stream to be displayed. I just upgraded "RTSPtoWeb - WebRTC" to 1.2.0 and the issue seems to be resolved. Unfortunately my stream now have about a 3-4 second delay that they didn't have before the update, but this can probably be closed out.

allenporter commented 2 years ago

Hmmm, the backend should not change the frontend behavior as far as I know. My impression was I saw this on other nest cams too.

If you have a 3-4 second delay it sounds like it's using low latency HLS (e.g. if a Preload stream checkbox is available for example when opening the stream in the more info box.

jdehlin commented 2 years ago

Ok I spoke too soon. The integration wasn't connected to the addon after the update. Following a reload, the streams are back to real-time and the blank card after switching tabs issue is back.

Regarding the the picture glance card, I don't think it's limited to that. I get the same behavior with other streaming cards (e.g. Frigate Card - issue).

allenporter commented 2 years ago

Sure, the frigate card is just overriding the ha video player. Likely the glance card setting is just defaulting to auto and moving it to use the image via pulling a video frame and I didn't notice.

jdehlin commented 2 years ago

Got it. Please let me know if I can provide any more info for debugging or if I should report this in a different repo.

allenporter commented 2 years ago

Thank you for all the details, that was very helpful. I was able to track down the cause and I have a proposed fix in flight.