home-assistant / frontend

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

Generic camera streaming continues even when stopped #8630

Closed millallo closed 3 years ago

millallo commented 3 years ago

Checklist

Describe the issue you are experiencing

I have a simple generic camera showed with the picture-glance card. When I start streaming, jpeg traffic starts but it doesn't stop when I close the streaming window, traffic continues to go on. Only a refresh of browser stops it.

Describe the behavior you expected

when I close the camera window, jpeg traffic should stop.

Steps to reproduce the issue

  1. Click on the camera icon at the bottom center of the picture-glance card.
  2. See jpeg stream on the new window
  3. Close the window
  4. Traffic continues

What version of Home Assistant Core has the issue?

core-2021.3.2

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Firefox >80, Safari >14

Which operating system are you using to run this browser?

No response

State of relevant entities

Configuration:

camera:
  - platform: generic
    name: Telecamera
    still_image_url: http://192.168.x.y/tmpfs/snap.jpg
    username: xxx
    password: xxx
    framerate: 2
    verify_ssl: false

State:

state: idle
access_token: c621e2934f23e4390c2eeec9f8eacffa8fa304ebb2cff1045bb73c896ab3cd54
friendly_name: Telecamera
entity_picture: >-
  /api/camera_proxy/camera.telecamera?token=c621e2934f23e4390c2eeec9f8eacffa8fa304ebb2cff1045bb73c896ab3cd54
supported_features: 0

Problem-relevant frontend configuration

type: picture-glance
title: Telecamera
entities:
  - entity: camera.telecamera
tap_action:
  action: navigate
camera_image: camera.telecamera

Javascript errors shown in your browser console/inspector

No errors and no logs

This is the network monitor widget that suggests me to open this issue :) Screen Shot 2021-03-13 at 15 45 38

barrymossel commented 3 years ago

My HA companion app used over 20GB this month because the video keeps streaming after closing the app or even when changing the view/tab within the app. This also goes for the (mobile) browser. Video should stop streaming after being out of view.

barrymossel commented 3 years ago

I am using streams from MotionEye located at a local ip (192.168.1.82:8081). When opening this url in a browser window, the behavior is the same as in HA and traffic continues even after closing the browser or changing browser tabs. When I check the streams from the MotionEye interface though, the traffic peaks when viewing the streams (obviously). When I change browser tab to something else the traffic from the MotionEye streams disappear, which also happens when closing the browser. Before using these streams from MotionEye I had different cameras with different protocols integrated and I never experienced these levels of data usage. So I guess it's due to the nature of the stream. Is there something that can be done to close the streams like the MotionEye interface does?

Plazmin commented 3 years ago

A similar situation for me. Cameras configured through onvif integration or platform: generic. Even though the streaming window is closed, the connection still exists and large amounts of data are transferred as if the camera image was being viewed. This is a big problem with LTE connection. Closing the browser does not help, the rtsp connection exists between the camera and Home assistant server. Only HA reloading helps (until the live stream window is opened again) When I play a stream from the same camera via VLC media player, the connection is closed immediately after exiting the program .

core-2021.4.6 supervisor-2021.04.3 firefox 78.10.0esr

noli2000 commented 3 years ago

Hi there, I'm experiencing the same issue and confirm this behavior on both Firefox and Chrome. Closing the tab, or killing the appropriate process (using bandwidth) in Task Manager stops the stream.

benquan commented 3 years ago

Similar situation. When closing the stream the network keeps working. It consumed all of my mobile data plan in no time.

I have tested in mobile app, in mobile chrome and desktop chrome. Same issue in all of them, data keeps streaming.

This is my config:

stream:

camera:
  - platform: mjpeg
    name: OctoPrint
    still_image_url: http://192.168.0.60/webcam/?action=snapshot
    mjpeg_url: http://192.168.0.60/webcam/?action=stream

In lovelace I am using the built-in generic camera card.

type: picture-glance
title: Octoprint
entities: []
camera_image: camera.octoprint

This is my data consumption after closing the stream.

48ff9734268b7b6f62310f3702f9632225533588

I also use a camera from an android phone using:

android_ip_webcam:
  - host: 192.168.0.90
    port: 8080
    name: Camara Gato

and have the exact same issue

This is related to issue #979 but the problem is more generic, not just using the App.

bramkragten commented 3 years ago

This should be fixed in the current beta