Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stream not working with Version 2.0 #49

Closed
weitheng opened this issue May 4, 2021 · 36 comments
Closed

Stream not working with Version 2.0 #49

weitheng opened this issue May 4, 2021 · 36 comments
Labels
bug Something isn't working

Comments

@weitheng
Copy link

weitheng commented May 4, 2021

Getting error message on new version. Tried on Safari Desktop and HA iOS App
Screenshot 2021-05-04 at 06 05 50

@Se7enair
Copy link

Se7enair commented May 4, 2021

Same problem here.

card:

type: 'custom:webrtc-camera'
url: '!secret garten_kamera_hof_stream'

core: 2021.4.5
su: 2021.04.3
HomeAssistant OS: 5.12
Browser: Firefox 88.0

Same on iPhone 7 wit iOS 14.5

Changed nothing, except the update. Updated from 1.3 to 1.4 to 2.0 without restart between 1.4 and 2.0. Did a restart after 2.0

@LEJOUI
Copy link

LEJOUI commented May 4, 2021

In the logs I've this error

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/connection.py:87
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 9:09:09 (2 occurrences)
Last logged: 9:09:09

[140175567879424] Received invalid command: webrtc/stream

@inah72
Copy link

inah72 commented May 4, 2021

reload page many times then works with chrome or empty cache

@LEJOUI
Copy link

LEJOUI commented May 4, 2021

reload page many times then works with chrome or empty cache

Thanks. Cache deleted fixed it.

@shammysha
Copy link

shammysha commented May 4, 2021

New error after deleting cache:

{"error":"RTSP Client Unauthorized 401"}

Downgrading to1.4.0 - all ok

@weitheng
Copy link
Author

weitheng commented May 4, 2021

Now seems to work fine, changed nothing on HA iOS App, but cleared cache and website data on Safari Web

@AlexxIT
Copy link
Owner

AlexxIT commented May 4, 2021

The cache problem is fixed in the latest master version.

@shammysha How do you set a password for your camera? In the lovelace card or in the camera entity?

@AlexxIT AlexxIT added the bug Something isn't working label May 4, 2021
@Se7enair
Copy link

Se7enair commented May 4, 2021

BigBuckBunny Stream is playing after clearing the cache.
My camera now shows
ERROR: Support only RTSP-Stream

@AlexxIT
Copy link
Owner

AlexxIT commented May 4, 2021

RTSP check is very simple, url must starts with rtsp

@shammysha
Copy link

The cache problem is fixed in the latest master version.

@shammysha How do you set a password for your camera? In the lovelace card or in the camera entity?

I do not set passwd for camera anywhere

@AlexxIT
Copy link
Owner

AlexxIT commented May 4, 2021

@shammysha so you need to do it, because your camera doesn't work without it

@Se7enair
Copy link

Se7enair commented May 4, 2021

RTSP check is very simple, url must starts with rtsp

The url is a rtsp-stream. But I use a secret there. If I change to the direct url it works.

So using a secret is not possible at the moment. It worked till 1.3

type: 'custom:webrtc-camera'
url: '!secret garten_kamera_hof_stream'

This is my url: rtsp://user:[email protected]:554/h264Preview_01_main

@shammysha
Copy link

shammysha commented May 4, 2021

@shammysha so you need to do it, because your camera doesn't work without it

In rtsp url to camera password exist.

  - type: 'custom:webrtc-camera'
    url: >-
      rtsp://192.168.1.10:554/user=admin&password=********&channel=1&stream=1.sdp?real_stream--rtp-caching=100

Config does not changes between versions

@weitheng
Copy link
Author

weitheng commented May 4, 2021

The cache problem is fixed in the latest master version.

@shammysha How do you set a password for your camera? In the lovelace card or in the camera entity?

Updated to the master version. Stream seems to take more than 10-15 seconds to load (blank screen) on my HA iOS App running on iOS 14.6, iPhone 11; iPadOS 14.4.1, iPad mini 4. Previously stream loads instantly. Is this normal?

On Safari Desktop, there's almost no delay. I suspect it is due to the CPU usage as it defaults to MSE at the start or because iOS 14.6 doesn't play over MSE, as once WebRTC takes over (delay of few seconds), it plays smoothly and instantly?

@AlexxIT
Copy link
Owner

AlexxIT commented May 4, 2021

@Se7enair you can't use secret in lovelace card. Create ffmpeg or generic camera and use it entity in webrtc card config

@AlexxIT
Copy link
Owner

AlexxIT commented May 4, 2021

@shammysha fix in latest master version

@majkers
Copy link

majkers commented May 4, 2021

@AlexxIT how about new official version? :)

@AlexxIT
Copy link
Owner

AlexxIT commented May 4, 2021

Need to collect more hotfixes

@AlexxIT
Copy link
Owner

AlexxIT commented May 4, 2021

@weitheng iOS doesn't support MSE, I have fixed readme.

WebRTC not always starts instantly. Sometimes it takes time to get a public IP address. In theory, the connection can be speeded up, but there is a lot of work need to be done.

@Se7enair
Copy link

Se7enair commented May 4, 2021

@Se7enair you can't use secret in lovelace card. Create ffmpeg or generic camera and use it entity in webrtc card config

I tested only on a testcard directly in lovelace. There it wont work.

Normally I use the card as a popup on my dashboard, there it works with secret.

              action: fire-dom-event
              browser_mod:
                command: popup
                title: Hof
                style:
                  .: |
                    :host .content {
                      width: 1280px;
                    }
                card:
                  type: 'custom:webrtc-camera'
                  url: !secret garten_kamera_hof_stream

@Gferretta
Copy link

Gferretta commented May 4, 2021

Do not function for me. 😪
Last version show this errors
Screenshot_20210504-085324_Home Assistant.jpg

Reinstaling v1.4.0 and works like a charm again

@shammysha
Copy link

@shammysha fix in latest master version

Reinstall via HACS, error {"error":"RTSP Client Unauthorized 401"} still exists

@majkers
Copy link

majkers commented May 4, 2021

@shammysha fix in latest master version

Reinstall via HACS, error {"error":"RTSP Client Unauthorized 401"} still exists

master is not the same as HACS version...at least for now

@weitheng
Copy link
Author

weitheng commented May 4, 2021

@weitheng iOS doesn't support MSE, I have fixed readme.

WebRTC not always starts instantly. Sometimes it takes time to get a public IP address. In theory, the connection can be speeded up, but there is a lot of work need to be done.

I see. But before updating to Version 2.0.0, it was way faster, no long delay before the stream was played. Because right now, it is consistently taking 10-15 seconds before the streams starts playing. I have tried multiple times and over different networks (WiFi, Mobile Data)

Is it normal to be getting this message every time before a stream starts? 2021-05-04 21:45:28 DEBUG (webrtc) [custom_components.webrtc.utils] 2021/05/04 21:45:28 websocket.JSON.Receive EOF

@shammysha
Copy link

@shammysha fix in latest master version

Reinstall via HACS, error {"error":"RTSP Client Unauthorized 401"} still exists

master is not the same as HACS version...at least for now

Thank You. Will test when HACs version become the same as master :)

@weitheng
Copy link
Author

weitheng commented May 4, 2021

@weitheng iOS doesn't support MSE, I have fixed readme.
WebRTC not always starts instantly. Sometimes it takes time to get a public IP address. In theory, the connection can be speeded up, but there is a lot of work need to be done.

I see. But before updating to Version 2.0.0, it was way faster, no long delay before the stream was played. Because right now, it is consistently taking 10-15 seconds before the streams starts playing. I have tried multiple times and over different networks (WiFi, Mobile Data)

Is it normal to be getting this message every time before a stream starts? 2021-05-04 21:45:28 DEBUG (webrtc) [custom_components.webrtc.utils] 2021/05/04 21:45:28 websocket.JSON.Receive EOF

Getting this while playing on iOS HA App:

2021-05-04 21:45:28 DEBUG (webrtc) [custom_components.webrtc.utils] 2021/05/04 21:45:28 websocket.JSON.Receive EOF
2021-05-04 21:45:28 DEBUG (webrtc) [custom_components.webrtc.utils] [GIN] 2021/05/04 - 21:45:28 | 200 | 11.75648582s | 127.0.0.1 | GET "/ws?url=rtsp://admin:[email protected]:554/cam/realmonitor?channel%3D1%26subtype%3D0%26unicast%3Dtrue%26proto%3DOnvif"
2021-05-04 21:45:28 DEBUG (webrtc) [custom_components.webrtc.utils] 2021/05/04 21:45:28 websocket.JSON.Receive EOF
2021-05-04 21:45:28 DEBUG (webrtc) [custom_components.webrtc.utils] [GIN] 2021/05/04 - 21:45:28 | 200 | 11.756810889s | 127.0.0.1 | GET "/ws?url=rtsp://admin:[email protected]:554/cam/realmonitor?channel%3D12%26subtype%3D0"

@shammysha
Copy link

shammysha commented May 4, 2021 via email

@weitheng
Copy link
Author

weitheng commented May 4, 2021

@weitheng iOS doesn't support MSE, I have fixed readme.
WebRTC not always starts instantly. Sometimes it takes time to get a public IP address. In theory, the connection can be speeded up, but there is a lot of work need to be done.

I see. But before updating to Version 2.0.0, it was way faster, no long delay before the stream was played. Because right now, it is consistently taking 10-15 seconds before the streams starts playing. I have tried multiple times and over different networks (WiFi, Mobile Data)
Is it normal to be getting this message every time before a stream starts? 2021-05-04 21:45:28 DEBUG (webrtc) [custom_components.webrtc.utils] 2021/05/04 21:45:28 websocket.JSON.Receive EOF

Getting this while playing on iOS HA App:

2021-05-04 21:45:28 DEBUG (webrtc) [custom_components.webrtc.utils] 2021/05/04 21:45:28 websocket.JSON.Receive EOF
2021-05-04 21:45:28 DEBUG (webrtc) [custom_components.webrtc.utils] [GIN] 2021/05/04 - 21:45:28 | 200 | 11.75648582s | 127.0.0.1 | GET "/ws?url=rtsp://admin:[email protected]:554/cam/realmonitor?channel%3D1%26subtype%3D0%26unicast%3Dtrue%26proto%3DOnvif"
2021-05-04 21:45:28 DEBUG (webrtc) [custom_components.webrtc.utils] 2021/05/04 21:45:28 websocket.JSON.Receive EOF
2021-05-04 21:45:28 DEBUG (webrtc) [custom_components.webrtc.utils] [GIN] 2021/05/04 - 21:45:28 | 200 | 11.756810889s | 127.0.0.1 | GET "/ws?url=rtsp://admin:[email protected]:554/cam/realmonitor?channel%3D12%26subtype%3D0"

Had a looked at the code in master branch and noticed the difference in using web sockets (ws) over stream in Version 2.0.0. Previously video stream takes milliseconds to load
2021-05-04 21:51:27 DEBUG (webrtc) [custom_components.webrtc.utils] [GIN] 2021/04/22 - 21:51:27 | 200 | 147.851143ms | 127.0.0.1 | POST "/stream" but in Version 2.0.0, using ws, video streams take seconds to load
2021-05-04 21:45:28 DEBUG (webrtc) [custom_components.webrtc.utils] [GIN] 2021/05/04 - 21:45:28 | 200 | 11.75648582s | 127.0.0.1 | GET "/ws?url=rtsp://admin:[email protected]:554/cam/realmonitor?channel%3D1%26subtype%3D0%26unicast%3Dtrue%26proto%3DOnvif"

@shammysha
Copy link

@shammysha fix in latest master version

Reinstall via HACS, error {"error":"RTSP Client Unauthorized 401"} still exists

Changed url to format rtsp://admin:password@address:port
Now all work correct

@Gferretta
Copy link

@shammysha fix in latest master version

Reinstall via HACS, error {"error":"RTSP Client Unauthorized 401"} still exists

Changed url to format rtsp://admin:password@address:port
Now all work correct

I has setting in this form and not working.

@nau53
Copy link

nau53 commented May 4, 2021

Hi Alex, thanks for update.

My cameras set like this:
rtsp://admin:Password&[email protected]:554/ISAPI/Streaming/Channels/501"

With version 2 it stop working (error parsing). I think 2.0 parse it wrong because & symbol in password. With 1.4 it worked just fine.
2021-05-04 22:32:59 DEBUG (webrtc) [custom_components.webrtc.utils] 2021/05/04 22:32:59 Stream Try Connect rtsp://admin:Password
2021-05-04 22:32:59 DEBUG (webrtc) [custom_components.webrtc.utils] 2021/05/04 22:32:59 parse "rtsp://admin:Password": invalid port ":Password" after host

@majkers
Copy link

majkers commented May 4, 2021

ok testing v2.0.1 with two cameras. I have it working for the first but the second is not with error (EDIT it stared but errors still in javascript console):

webrtc-camera.js?v2.0.1:72 DOMException: Failed to execute 'appendBuffer' on 'SourceBuffer': This SourceBuffer is still processing an 'appendBuffer' or 'remove' operation. at WebSocket.ws.onmessage (http://ha:8123/webrtc/webrtc-camera.js?v2.0.1:70:34)

And one more. It looks like it breaks my external nabu casa access after some while. I asume it uses MSE access and although the stream is being displayed I still see loading circle (using android device with nabu casa access) and after a while working like this i suddenly can't access my nabu casa address. It takes some time and it works again...

The same as above on Chrome PC with this error in console:

https://XXXX.ui.nabu.casa/api/hls/2b3a36f0cfc41c0e3b81415d5dab9cb6637e1be0f44a8b849c4dbb6d0d6c98d8/segment/232.m4s 404 (Not Found)

Looks like trying to access nabu casa with MSE is problematic. When is switches to WebRTC I see no more errors in console and stream is working fine.

I think it should be configurable wheter to use MSE or WebRTC first when connecting.

@AlexxIT
Copy link
Owner

AlexxIT commented May 4, 2021

/api/hls/... - this is not from my component

Failed to execute 'appendBuffer' and loading circle is normal situation with some "slow" cameras or connection.

Maybe you just have a problem with the Internet?

@majkers
Copy link

majkers commented May 4, 2021

But these errors heppen when stream is in connection phase. After connected they stop. No I have no problems with connection to the internet

@weitheng
Copy link
Author

weitheng commented May 4, 2021

The cache problem is fixed in the latest master version.
@shammysha How do you set a password for your camera? In the lovelace card or in the camera entity?

Updated to the master version. Stream seems to take more than 10-15 seconds to load (blank screen) on my HA iOS App running on iOS 14.6, iPhone 11; iPadOS 14.4.1, iPad mini 4. Previously stream loads instantly. Is this normal?

On Safari Desktop, there's almost no delay. I suspect it is due to the CPU usage as it defaults to MSE at the start or because iOS 14.6 doesn't play over MSE, as once WebRTC takes over (delay of few seconds), it plays smoothly and instantly?

The long delay is fixed with the latest master version. Only a tiny 1-2s now, barely noticeable. Thanks @AlexxIT :)

@AlexxIT
Copy link
Owner

AlexxIT commented May 7, 2021

I think problems in this issue closed in latest version

@AlexxIT AlexxIT closed this as completed May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants