blakeblackshear / frigate-hass-integration

Frigate integration for Home Assistant
MIT License
751 stars 119 forks source link

2024.11.0 WebRTC stream not working #761

Open timota opened 6 days ago

timota commented 6 days ago

Version of the custom_component

5.4.0

Configuration

Describe the bug

After HASS upgrade to 2024.11, streams for cameras that exposed via Frigate/Frigate integration are stoped working, only static image. I'm not using Frigate card, only native HASS camera view. Information about my steup:

WebRTC is enabled in Frigate Integration. No errors in browser console.

Debug log


2024-11-07 23:02:06.445 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140568319030848] Error handling message: Unknown error (unknown_error) from 192.168.1.30 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/camera/webrtc.py", line 263, in ws_webrtc_offer
    await camera.async_handle_async_webrtc_offer(offer, session_id, send_message)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 634, in async_handle_async_webrtc_offer
    answer = await self.async_handle_web_rtc_offer(offer_sdp)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/frigate/camera.py", line 332, in async_handle_web_rtc_offer
    answer = await resp.json()
             ^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 80, in json
    return await super().json(*args, loads=loads, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1277, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 500, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url='http://192.168.1.209:5000/api/go2rtc/webrtc?src=cam_back'
timota commented 6 days ago

Also, my cameras stream in h265, supposed, webrtc should not work(I may be wrong).

Probably, url in log not accessible (http://192.168.1.209:5000/api/go2rtc/webrtc?src=cam_back)

campbellhennessy commented 1 day ago

I seem to be having a similar issue. After upgrade I am only seeing static images when I click my Frigate camera entities. I prefer to use the native camera view but I tried in the Frigate card. In the Frigate card the stream does work.

NickM-27 commented 1 day ago

do you have webrtc enabled in the frigate integration configure menu?

mckochan commented 1 day ago

Same issue (static image instead of stream). I just tried checking webrtc enabled and it did not affect the stream in picture entity card. This was working in previous 2024.10 fine with WebRTC integration. I deleted the WebRTC integration because I thought I didn't need it, but added it back now and the stream still doesn't work.

kgiedrius commented 18 hours ago

same issue after upgrated HASS to 2024.11

kgiedrius commented 17 hours ago

HASS stopped supporting WEBRTC, not it has native and I think integration must be updated

NickM-27 commented 16 hours ago

The same implementation still works the same, and multiple users confirmed during the beta that it works without issues

campbellhennessy commented 15 hours ago

do you have webrtc enabled in the frigate integration configure menu?

Thanks! Once I enabled WebRTC in the configure menu it started to work. For others, perhaps WebRTC is not setup in your frigate config?

However, I thought it used to work with MSE and didn't require WebRTC for the Frigate integration.

mckochan commented 15 hours ago

Oh yeah, previously I must have been using MSE since HA didn't support Webrtc in native cards even with the HACs integration. The bigger problem here might be the fallback to MSE is not working correctly. (Although we also need to figure out WebRTC is not working for so many of us).

NickM-27 commented 15 hours ago

HA does not use MSE in native cards, in the past it used HLS

kgiedrius commented 15 hours ago

WebRTC

where and how to enable. only in frigate or hass also ?

NickM-27 commented 15 hours ago

It needs to be enabled in Frigate itself (https://docs.frigate.video/configuration/live#webrtc-extra-configuration) as well as in the Frigate configure menu in HA integrations

kgiedrius commented 15 hours ago

will try

mckochan commented 14 hours ago

HA does not use MSE in native cards, in the past it used HLS

Thanks, HLS is what I meant then.

I now have WebRTC working after following your instructions two posts up on enabling WebRTC in Frigate and its integration. I think this issue can be closed but another issue is the HLS fallback is not working for the Go2RTC streams in a native home assistant card.

kgiedrius commented 10 hours ago

tried to enable webrtc - nothing helps. From homeassistant GUI camera view works, but recordings - do not
I can see images of existing recording - but playback - fails in Frigate GUI - everything works

NickM-27 commented 10 hours ago

From homeassistant GUI camera view works, but recordings - do not

that is an unrelated issue, and a bug in home assistant