Realtime camera streaming without any delay - WebRTC

For those who do not see the cameras when connected remotely, try to increase the number of ports in the integration settings. For example 50000-59999. I think in the latest versions this setting is no longer needed. As well as port forwarding on the router.

Video works in most cases (except the case of symmetric NAT).

Sometimes it takes a few tries to connect. The latest version of the component reconnects itself without reloading the page.

If the theory proves to be true, I will remove this setting.

1 Like

Many thanks, @AlexxIT. I tried as you suggested. Unfortunately i must be behind the dreaded symmetric NAT. Video still does not load for me externally.

AlexxIT, Just want to say thank you, Unifi Camera’s running in lovelace with zero delay, very cool!

1 Like

AlexxIT, great job. Working on a Dahua DH-SD22204TN PTZ and IMOU IPC-22 cameras. Just to Ask if there is any way to change the aspect ratio. It shows on 4:3 and the camera stream is at 16:4

Stupid question but does it also take a long time to load the stream for ou ? is there a way to debug this or correct it?

I am trying to build exactly this with help from another post: (SIP Doorbell, android tablet and HA integration - #2 by greengolfer)

I am using a Hikvision DS-KB8113-IME1 doorbell and it works great with this custom component and the audio works well too. Thank you AlexxIT! Please note that the previous version of this Hikvision doorbell does not work as a standalone model so is less suitable if you also want to use the SIP functions as part of an intercom system.

I also have Annke C800 IP cameras and haven’t been able to get them to work directly with this component but can use them if I pick up the rtsp stream from Blue Iris instead, does anyone know what might be causing the rtsp stream direct from the cameras not to work? They are streaming in H264 both direct and from Blue Iris.

Do you think it would be possible to have 2 streams for each camera ? For example one 480p/720p in the default lovelace card, and then switch to 1080p/2K/4K resolution when the stream is set to full screen ? :slight_smile:

I have 3 4K cameras, and this component use some CPU ressources. My CPU average load has jumped from 5% to more than 20% even when the tab currently displayed does not include the stream cards.

Overall, seems really stable so far for me.

I implemented this just with browser mod which will call hd Stream. The “small” preview is in sd

1 Like

Looks nice ! :slight_smile:
Could you please elaborate how you dit it exactly ? what do you mean with ‘browser mod’ ?

Thanks !

what dashboard do u use? something like dwan’s dashboard? or HKI?
I made a script wich is called when clikcing on the camera image on my dasboard (hki and dwain’s) you can also make a glance picture thing and call a script. mine looks like:

garage_cam_popup:
  sequence:
    - service: browser_mod.popup
      data:
        title: Live View...
        large: true
        hide_header: true
        # auto_close: false
        card:
          type: 'custom:webrtc-camera'
          url: 'rtsp://40.40.40.220:554/media/stream1'
2 Likes

I use neither dwan nor HKU’s card, just the brand new default WebRTC lovelace card.

Thanks for the tip ! I will have a look at that.

I have the same issue with my Dahua camera as well. For some reason the stream plays in 4:3.

Nice. 2 way audio works? What are you using for sip to WebRTC gateway?

I have 2 way audio working using sip between the doorbell and a softphone installed on the receiving tablet so far and I currently have 1 way audio and video using Alexxit’s component in WebRTC. I am using freepbx (asterisk) that is running as a virtual machine on my network the only thing currently blocking 2 way audio is I can’t work out how to create a CA authority certificate that has a hostname that resolves to the virtual machine on my local network, but I think that once that’s working the 2 way audio will work and the Alexxit’s component proves that it’s worth doing using webrtc!

1 Like

The latest version has changed the default setting of the UDP port range. If you have changed it before - set two zeros in the integration settings and disable UDP port forwarding on the router.

This should work fine for most users.

Use port forwarding only if you’re having trouble connecting.

A small number of ports with a large number of cameras on a page works very badly. There should be many more ports than cameras.

1 Like

Good day.
Im getting this error on the card “Opera doesn’t supported”
tried adding manually to resources with this:

  # - url: /custom_components/webrtc/local/webrtc-camera.js
  #   type: module   

and then i get “Custom element doesn’t exist: webrtc-camera.”

any guidance is much appreciated

I keep getting this error from one camera that is connected via repeater:

Can't start stream: rtsp://192.168.XXX.XXX/ch0_0.h264, because: 0, message='Attempt to decode JSON with unexpected mimetype: ', url=URL('http://localhost:8083/stream')

Stream from this camera works in traditional way in HA…Any idea?

You may enable debug and check something interesting there

1 Like

I’m curious, is there any way to configure the default action of the card to pause the stream rather than play it?

Looked promising, but…

HassOS is running in a VM. Tried to add a Sonoff Camera but while it sometimes seems to work it stays forever on ‘init connection’, then ‘trying to start stream’. Sometimes it shows the stream, sometimes it don’t. When showing the stream you can the stream hanging (seconds don’t update) and eventually stops and tries to reconnect.

image

VM is running on a new i3 NUC and MotionEye run2 three rtsp stream easily (in a different VM). Also tried to stop the MotionEye container, but that doesn’t help.

Unfortunate…