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.55k stars 183 forks source link

go2rtc working fine, but no video in HA due to "Uncaught error from Chrome" / "this.ondata is not a function" errors #677

Closed SR-G closed 2 months ago

SR-G commented 8 months ago

Summary : i'm not able to view any stream from an EZVIZ inside HomeAssistant. However, the URL taken from WebRTC (through WebRTC UI) does work with ffplay. And i have numerous errors in ha log :

WebSocket.<anonymous> (/webrtc/video-rtc.js:338:22)
2024-04-02 23:34:41.868 ERROR (MainThread) [frontend.js.latest.202403070] Uncaught error from Chrome 123.0.0.0 on Linux x86_64
TypeError: this.ondata is not a function

Home Assistant is installed through docker (latest docker image = up to date + fresh install) WebRTC has been installed manually from github release (= 3.5.1)

My card in HA UI is : (password removed) :

type: custom:webrtc-camera
url: rtsp://admin:XXXXXX@192.168.8.194:554/Streaming/Channels/101
muted: true

(note : it's the same with /102 (lower resolution) + this exact same rtsp URL works fine when directly used with ffplay) (also the same with muted line being there or not)

If i go under the :1984 WebRTC page and under "links.html" for that stream, i see this (i suppose) proxified URL :

ffplay -fflags nobuffer -flags low_delay -rtsp_transport tcp "rtsp://<server running HA and webrtc>:8554/rtsp://admin:XXXXXX@192.168.8.194:554/Streaming/channels/102"

And ... this command is working fine ! So i believe that the WebRTC proxy is working. But not the rendering inside CHROME. Due to these "this.ondata is not a function" errors ...

Any ideas ?

Extra notes :

SR-G commented 8 months ago

Mhh, ok, have just tested on a different computer (this time running Windows 11 and not Archlinux), and on that one (with Vivaldi) :

The non-working station (my main station) is running latest ARCHLINUX / CHROME (version = 123, supposedely with x265 decoding features) (Version 123.0.6312.86 (Official Build) (64-bit), of course with hardware acceleration activated in settings) + a NVIDIA T600 GPU

                  .o+`                   ----------- 
                 `ooo/                   OS: Arch Linux x86_64 
                `+oooo:                  Kernel: 6.6.10-arch1-1 
               `+oooooo:                 Uptime: 4 days, 1 hour, 18 mins 
               -+oooooo+:                Packages: 1651 (pacman), 5 (flatpak) 
             `/:-:++oooo+:               Shell: zsh 5.9 
            `/++++/+++++++:              Resolution: 1920x1080, 1920x1080, 1200x1920, 1920x1080 
           `/++++++++++++++:             DE: GNOME 46.0 
          `/+++ooooooooooooo/`           WM: Mutter 
         ./ooosssso++osssssso+`          WM Theme: Adwaita 
        .oossssso-````/ossssss+`         Theme: Adwaita [GTK2/3] 
       -osssssso.      :ssssssso.        Icons: Adwaita [GTK2/3] 
      :osssssss/        osssso+++.       Terminal: terminator 
     /ossssssss/        +ssssooo/-       CPU: 11th Gen Intel i7-11700K (16) @ 4.900GHz 
   `/ossssso+/:-        -:/+osssso+-     GPU: Intel RocketLake-S GT1 [UHD Graphics 750] 
  `+sso+:-`                 `.-/+oso:    GPU: NVIDIA T600 
 `++:.                           `-/+/   Memory: 18706MiB / 31832MiB 
AlexxIT commented 7 months ago

I don't think I can make a test stand with Arch Linux and Chrome 123. I think some problem with HTML5 MSE for this environment.

songochain commented 7 months ago

Hi I got this error in home Assistant

11:55:24.148 ERR github.com/AlexxIT/go2rtc/internal/mjpeg/init.go:166 > error="streams: wrong login"

It's a camera vacuum

BR.

Basti256 commented 4 months ago

I've might have the same error here:

Logger: frontend.js.latest.202407050
Quelle: components/system_log/__init__.py:333
Erstmals aufgetreten: 11. Juli 2024 um 22:14:28 (1059 Vorkommnisse)
Zuletzt protokolliert: 15:25:41

Uncaught error from Edge 126.0.0.0 on Windows 10 TypeError: this.ondata is not a function WebSocket.<anonymous> (/webrtc/video-rtc.js:338:22)
Uncaught error from Chrome 126.0.0.0 on Windows 10 TypeError: this.ondata is not a function WebSocket.<anonymous> (/webrtc/video-rtc.js:338:22)
Uncaught error from Edge 126.0.0.0 on Windows 10 TypeError: Cannot read properties of null (reading 'addEventListener') WebRTCCamera.onopen (/webrtc/video-rtc.js:331:17) WebRTCCamera.onopen (/webrtc/webrtc-camera.js:177:30) WebSocket.<anonymous> (/webrtc/video-rtc.js:298:53)

I am running HA 2024.7.1 Frontendversion: 20240705.0

AlexxIT commented 2 months ago

Well. Your camera uses H265 codec. And that answers all your questions: https://github.com/AlexxIT/go2rtc?tab=readme-ov-file#codecs-madness