WebRTC icon indicating copy to clipboard operation
WebRTC copied to clipboard

WebRTC stream does not reinitialize after switching from MSE

Open Flumeded opened this issue 5 months ago • 2 comments

Steps to reproduce:

  1. Configured a card with 3 Streams, IMG first, then MSE (for general checking) and WebRTC as a fird stream (initially, for 2 way audio) This behavior also reproduces when only 2 streams ( 1 - MSE 2 - WebRTC) configured.
type: custom:webrtc-camera
ui: true
streams:
  - url: '"
  - url: rtsp://.../Preview_01_main
    webrtc: false
  - url: rtsp://.../Preview_01_sub
    mode: webrtc
    media: video,audio

Load the card. The first stream (MSE) works. Switch to the second stream (WebRTC) by clikin on the stream mode (See GIF below):

Image

The WebRTC stream fails to initialize. No video appears. Firefix on Mac also throws MIME error on both WebRTC and IMG Other browsers just stuck on black on loading (same behaviro in the Firefox if I specify ui: enabled)

When I reverse the order where WebRTC is placed first and reload the page it loads fine, however, if I switch WebRTC → MSE → WebRTC it errors out again on WebRTC

type: custom:webrtc-camera
ui: true
streams:
  - url: rtsp://.../Preview_01_sub
    mode: webrtc
    media: video,audio
  - url: rtsp://.../Preview_01_main
    webrtc: false

(See GIF below):

Image

Not much was found in the insepct → Network and Console I also enabled all debugs possible, but it seems everything works fine

13:55:50.903	debug	[streams] stop producer url=rtsp://<user>:<password>@192.168.31.16:554/Preview_01_main
13:55:50.964	debug	[webrtc] new consumer src=rtsp://<user>:<password>@192.168.31.16:554/Preview_01_main
13:55:51.052	debug	[webrtc] add consumer error=streams: codecs not matched: H265, AAC => VP8, VP9, H264, AV1, OPUS, G722, PCMU, PCMA, S16B, S16L
13:55:51.059	debug	[streams] start producer url=rtsp://<user>:<password>@192.168.31.16:554/Preview_01_main
13:55:53.379	debug	[streams] stop producer url=rtsp://<user>:<password>@192.168.31.16:554/Preview_01_main
13:55:53.524	debug	[webrtc] new consumer src=rtsp://<user>:<password>@192.168.31.16:554/Preview_01_sub
13:55:53.605	debug	[streams] start producer url=rtsp://<user>:<password>@192.168.31.16:554/Preview_01_sub

I will apprciate any assistance!

Flumeded avatar Jul 24 '25 10:07 Flumeded

I assume you use Firefox?

AlexxIT avatar Jul 25 '25 14:07 AlexxIT

I assume you use Firefox?

Yup, but I can replicate the same behavior in iOS HA App, Safari and Chrome. For example, in Safari I get: (RTC is frist → Then MSE -> RTC again and it does not load):

Image

Flumeded avatar Jul 25 '25 14:07 Flumeded