tsightler / ring-mqtt

Ring devices to MQTT Bridge
MIT License
574 stars 103 forks source link

Live streaming doesn't work in FF #541

Closed broyuken closed 1 year ago

broyuken commented 1 year ago

Describe the Bug

Live view doesn't work in firefox, works in chrome and iOS. Firefox gives audio only with a still image

Steps to Reproduce

Launch HA in firefox and view a camera

Expected Behavior

Live view works

Log Output

Not sure which logs you'd prefer here. Logs from HA, logs from ring-mqtt or logs from go2rtc. I can provide whichever ones you want. This may be a firefox limitation that you can't help though, but if thats the case at least it can be documented.

Screenshots

No response

Config File

mqtt_url: mqtt://auto_username:auto_password@auto_hostname
mqtt_options: ""
livestream_user: admin
livestream_pass: nottellingyou
disarm_code: ""
enable_cameras: true
enable_modes: false
enable_panic: false
branch: addon
debug: ring-*
location_ids:
  - ""

Install Type

Addon

Version

5.1.2

Operating System

HA OS

Architecture

x86_64

Machine Details

Intel NUC

tsightler commented 1 year ago

You haven't provided enough detail to understand your streaming pipeline configuration, but it sounds like you are using go2rtc addon, which is fine, but what cards are you using for viewing in HA?

In the end, ring-mqtt is only providing an RTSP stream, with H.264 and two audio tracks (AAC and Opus) allowing the client to pick the correct audio track. But no browser can play a native RTSP stream, so "something" has to convert that stream to a format that the browser can play back, that's not ring-mqtt, that's either the HA stream backend (uses LL-HLS) or some other tool which provides a WebRTC endpoint for generic RTSP cameras (go2rtc addon with RTSPtoWebRTC for example).

I have personally tested both HA native stream backend (HLS) and Go2RTC addon with RTSPtoWebRTC integration using Firefox 109.0 (latest version) with the latest HA version using a simple Picture Glance card, and it works fine, both video and audio. I haven't tested things like AlexxIT's WebRTC card, but if that doesn't work that's almost certainly an issue in that card, although it would be surprising.

broyuken commented 1 year ago

My setup I believe is what you now recommend in the update release notes. I have the go2rtc addon which has the following configured in it. Side note, it looks like it sometimes picks up my cameras automatically, sometimes not, so I added the full url's in.

image

I then added the RTSPtoWebRTC integration and configured it per the instructions on the go2rtc github, localhost port 1984 and added the stun host. Lastly, I updated the url for the cameras to rtsp://ha.xxxxxxxxx.com:8554/rtsp://admin:password@03cabcc9-ring-mqtt.local.hass.io:8554/a810872def16_live which is the link I got from the go2rtc addon webui.

Side note, I have the same issue viewing the video when I try to view it directly from the go2rtc page in firefox, but it works fine in chrome.

tsightler commented 1 year ago

Just to be thorough, I tested all eight of my cameras with HA native stream (HLS), HA+Go2RTC+RTSPtoWebRTC integration with HA native Picture Glance card (WebRTC), and also with the latest version of AlexxIT custom WebRTC card using Go2RTC addon. I tested live streams, event streams and transcoded event streams on latest Firefox, Chrome and Edge browsers as well as mobile version of Chrome (Andriod) and Safari (iOS). All software used was latest version, including Home Assistant, go2rtc, WebRTC card v3, etc. All cameras started up fine and played video and audio flawlessly on every browser.

I have not manually configured a single camera, all are automatically picked up by go2rtc (note that HA cameras don't appear under streams in the go2rtc config UI until the first time you actually stream from them following each restart).

I'm not sure what I can really do with this, Firefox works great for me, so it doesn't make sense to document it as a limitation, not to mention the fact the ring-mqtt itself supports exactly zero web browsers because it only provides RTSP anyway so it really makes no sense to document any browser limitation in this project at all.

If you have the same issue with the go2rtc page in Firefox then I have to assume it may be some bug in go2rtc. You can try enabling trace logging for the go2rtc addon and see if that helps identify anything, but I don't see how there's anything I can do with it since ring-mqtt is not providing the WebRTC stream.

broyuken commented 1 year ago

So for giggles, I enabled a wyze camera through mobileeye/rtsp and that stalls out on FF as well. So there must be something going on with Firefox that doesn't want to play nicely with either of my HA boxes. And my buddy has a similar setup at his house and his cameras fail to load as well. So it seems like there might be a larger issue with FF. I have tried this on multiple computers running FF too. At this point, it doesn't seem to be JUST ring-mqtt so I'll close the issue.

tsightler commented 1 year ago

I know AlexxIT has complained about Firefox buggy WebRTC support, for a while he even had a flag to enable/disable support for Firefox, but for me it does work fine, at least with the version I'm running which Firefox 109 on Windows. Curious what version and platform you are testing with?

broyuken commented 1 year ago

I’m on the latest version, and I’ve had this issue with windows 10 and 11.