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

Cannot stream with DashCast #88

Closed
bekriebel opened this issue Jun 10, 2021 · 66 comments
Closed

Cannot stream with DashCast #88

bekriebel opened this issue Jun 10, 2021 · 66 comments
Labels
bug Something isn't working
Milestone

Comments

@bekriebel
Copy link

When I attempt to stream with WebRTC Camera: DashCast, the Google Home Display comes up with the DashCast logo and then just goes to a blank black screen. I enabled debug logging, but the only message generated is: DEBUG (SyncWorker_6) [custom_components.webrtc.utils] DashCast to media_player.office_display.

I've attempted to cast to a Nest Home Display as well as an nVidia Shield; both act the same. I can cast to these device using the native Home Assistant camera devices through the cloud Google Assistant path, and casting other pages using DashCast seems to be working.

I've tested using my own RTSP feed as well as the Big Buck Bunny version and neither work.

Is there any other debugging that I can do to figure out why I'm not able to cast an RTSP stream using WebRTC Camera: DashCast?

@bekriebel
Copy link
Author

I forgot to mention. I also created a temporary web link. I can open this page find on other devices on the same network as the google home, but casting this page using DashCast also displays a blank screen, but casting it from a browser displays the page properly.

@AlexxIT
Copy link
Owner

AlexxIT commented Jun 10, 2021

Maybe your Hass and devices in different networks. Also check Configuration > General > Internal URL setting

@AlexxIT AlexxIT added the question Further information is requested label Jun 10, 2021
@bekriebel
Copy link
Author

Maybe your Hass and devices in different networks. Also check Configuration > General > Internal URL setting

My Home Assistant and Google/Nest Home devices are on the same network. I've also tried several variations of Internal URL setting and it has not changed anything. The nests are able to stream other things from Home Assistant, so I'm pretty sure the network & resolution are working correctly.

@AlexxIT
Copy link
Owner

AlexxIT commented Jun 10, 2021

Have you tried Home Assistant Cast?

@bekriebel
Copy link
Author

Do you mean https://cast.home-assistant.io/ ? If so, yes - that works properly.

@bekriebel
Copy link
Author

I've tried a few more things, including a publicly accessible home assistant URL using the Big Buck Bunny stream. Steps for this:

  1. Use the WebRTC Camera: Create Link service with link_id: testrtc2021061002, url: rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov, open_limit: 0, time_to_live: 3600.
  2. Verify that https://<MY_NABU_CASA_ADDRESS>.ui.nabu.casa/webrtc/embed?url=testrtc2021061002 opens properly in a browser. I confirmed that this opened fine both on and off my local network.
  3. Try to cast the URL from step 2 using DashCast. The receiving device just gets a black screen. This was tested both using DashCast: DashCast service and using https://madmod.github.io/dashcast/
  4. Confirm that using DashCast works for other plain websites.

I also tested casting to a regular ChromeCast device and I get the same result.

Does this work for you? It seems like the issue might just be that the chromecast devices don't support the video element format being displayed by the page generated by WebRTC Camera: Create Link. I don't think there's anything unique about my setup, so I'm curious if it is working for anyone else.

@bekriebel
Copy link
Author

Thinking it was maybe an issue with the newer MSE implementation, I tried version 1.4.0 of this component and it still does not work. With this version, I get a grey screen with video controls.

I'm starting to think that the issue may be related to the version of home assistant. I'm using the latest 2021.6.3 version.

@bekriebel
Copy link
Author

Ahh... @AlexxIT, I believe I found the issue. I spun up a development version of the dashcast service and found that from:

const url = document.referrer ? new URL(document.referrer) : window.location;

when loading through DashCast, the referrer is getting set to to the DashCast URL. In my case, https://bekriebel.github.io/dashcast/receiver.html. Because of this,

const config = Object.fromEntries(new URLSearchParams(url.search));

can't find the url or entity values and you get the error

Uncaught Error: Missing `url` or `entity`
    at HTMLElement.setConfig (VM19 webrtc-camera.js:605)
    at embed?url=test2021061005:39

Changing line 22 of index.html to const url = window.location; makes the dashcast service work exactly as expected, as well as makes a URL generated by the Create Link service work properly. Is there any reason the referrer was being captured in this? I'm not sure why that would be desired.

I'll submit a PR in a moment if that is an okay change.

bekriebel added a commit to bekriebel/WebRTC that referenced this issue Jun 11, 2021
When using DashCast or any other external site that may use the embedded
URL, we want to make sure we are using the original location of the page
instead of looking at the referrer URL. The referrer URL will not have
the `url` or `entity` parameters.

Fixes: AlexxIT#88
@AlexxIT
Copy link
Owner

AlexxIT commented Jun 11, 2021

There was some reason with referrer but I don't remember it. I should do some tests

@bekriebel
Copy link
Author

There was some reason with referrer but I don't remember it. I should do some tests

Sounds good. I tested several scenarios and couldn't find a case where it was needed. It looks like prior to v2, it wasn't using the referrer either. If there's a case where it is needed, I can add additional logic that tries both options.

@bekriebel
Copy link
Author

Have you had a chance to look at this? I saw a new version was released, but don't want to updated without this fix in place as well since DashCast is non-functional without it.

@AlexxIT
Copy link
Owner

AlexxIT commented Jul 1, 2021

Not at home for few weeks

bekriebel added a commit to bekriebel/WebRTC that referenced this issue Jul 8, 2021
When using DashCast or any other external site that may use the embedded
URL, we want to make sure we are using the original location of the page
instead of looking at the referrer URL. The referrer URL will not have
the `url` or `entity` parameters.

Fixes: AlexxIT#88
@exename
Copy link

exename commented Jul 17, 2021

i have same problem, chromecast 2013 and black screen after DashCast logo
upd: but i tried this fix, its not helped me.

@thefunkygibbon
Copy link

whats the crack with this then?

@mocozos
Copy link

mocozos commented Dec 12, 2021

I can't find the solution, same me problem here only dashcam logo, after update hassio to 2021.12.1

@serioja9
Copy link

Hi, it doesn't work for me anymore...

@AlexxIT AlexxIT added bug Something isn't working and removed question Further information is requested labels Dec 19, 2021
@pergolafabio
Copy link

hi @bekriebel , i want to apply your fix too...

but you say, line 22 =
const url = document.referrer ? new URL(document.referrer) : window.location;

i dont see that line there?

i have on line 22 this on below, how can i fix it?
const hass = {}
thnx

@bekriebel
Copy link
Author

hi @bekriebel , i want to apply your fix too...

but you say, line 22 = const url = document.referrer ? new URL(document.referrer) : window.location;

i dont see that line there?

i have on line 22 this on below, how can i fix it? const hass = {} thnx

It looks like the code has changed since I first did this. I haven't been using dashcast at all recently, so I'm not sure if this is still needed or what the new fix would be if it is.

@pergolafabio
Copy link

the issue still persist :-)

@Double-Dude
Copy link

Lovelace cast takes ages, so keen to try this dash cast. Still looking for a fix please.

@tbrausch
Copy link

tbrausch commented Apr 11, 2022

I originally opened issue number 255 regarding problems with DashCast on a Google Home Display. The results have changed since I last reported this issue and I thought I would explain how DashCast and lovelace cast now work on my system and version 2.3.0 of WebRTC Camera.

First of all, I get the exact same results if I use Dashcast to display a rtsp steam, or if I use the lovelace cast view service to display a view which utilizes the WebRTC card. When the service is first called, the Google Home Display acts like it is working, and it displays a single still image of the camera. The timer at the bottom left of the screen (by the play icon) starts to count up in seconds, but the video is not playing - it continues to display just a still image. This goes on for exactly 37 seconds, at which time the video starts to play and everything works normally. Like I said, this same behavior happens if I use the cast service to display a WebRTC camera view. Hopefully this info will help.

@tbrausch
Copy link

Any news on this issue?

@ahaverty
Copy link

I worked around this issue using a single-panel webrtc view of my camera with the cast.show_lovelace_view service, but would also love to see a fix, as this is quite slow compared to the dashcast service as @Double-Dude mentioned.

@AlexxIT
Copy link
Owner

AlexxIT commented Feb 6, 2023

My Google Nest Hub Max shows HTTP sites without problem

@jeffre
Copy link

jeffre commented Feb 9, 2023

You are right. I was able get casting working using the built-in play_media service (bit of a delay but decent enough for now):

  - service: media_player.play_media
    data:
      media_content_type: image
      media_content_id: >-
        http://[LOCAL IP]:1984/api/stream.mp4?src=camera.front_door_camera
    target:
      entity_id: media_player.nesthub

@AlexxIT
Copy link
Owner

AlexxIT commented Feb 10, 2023

Open HTTP link from DashCast and play MP4 file are different technologies and can have different restrictions.
Maybe Google Nest Hub 2nd gen has additional restrictions vs Google Nest Hub Max. I don't know...

@nikrays
Copy link

nikrays commented Mar 29, 2023

Ты прав. Мне удалось заставить работать кастинг с помощью встроенного сервиса play_media (с небольшой задержкой, но пока достаточно):

  - service: media_player.play_media
    data:
      media_content_type: image
      media_content_id: >-
        http://[LOCAL IP]:1984/api/stream.mp4?src=camera.front_door_camera
    target:
      entity_id: media_player.nesthub

Thanks a lot! This is the only way to help! No other way!

@weber8thomas
Copy link

All of you can try to use https://stestagg.github.io/dashcast/ service and cast stream.html page from your go2rtc WebUI.

I got the DashCast logo with a subtext that says: "Loading: http://[private ip]:1984/stream.html?src=camera.front_door_camera"

That same url works well in my browser.

I also tested using the hostname (same results). And I tested with and without "Force display" - but that didn't help either (just displayed a never-ending loading circle).

Edit to add context: I am using a Google Nest Hub 2nd gen (System firmware version: 324896; Cast firmware: 1.56.324896)

Same issue here on Nest Hub 2nd gen and exact same system + cast firmware

@filikun
Copy link

filikun commented May 15, 2023

I actually got it to work with the DashCast force option. http://LOCAL_IP:5000/live/webrtc/stream.html?src=NAM_OF_CAMERA

It did show the stream for less than a minute though.

@atv2016
Copy link

atv2016 commented Sep 8, 2023

It looks like this is rearing it's ugly head again. Webrtc dash cast not working, default dash cast screen only. This is to gen 1 chromecast, was working days ago..

@haroldboom
Copy link

haroldboom commented Sep 8, 2023

It looks like this is rearing it's ugly head again. Webrtc dash cast not working, default dash cast screen only. This is to gen 1 chromecast, was working days ago..

I now have the same issue, was working perfectly until a day or so ago. Maybe the 2023.9 update broke it or maybe its just a coincidence. Everythign else casts fine from HA, dashboards, media, cameras etc only WebRTC isn't working

@atv2016
Copy link

atv2016 commented Sep 9, 2023 via email

@haroldboom
Copy link

@@.> any thoughts? Looks like HA or the latest webrtc update broke something. But the webrtc update was 2 weeks ago and I don’t remember when I last updated. Can you test rtsp casting using the latest Homeassistant ?

________________________________ From: haroldboom @.
> Sent: 08 September 2023 23:43 To: AlexxIT/WebRTC @.> Cc: atv2016 @.>; Comment @.> Subject: Re: [AlexxIT/WebRTC] Cannot stream with DashCast (#88) It looks like this is rearing it's ugly head again. Webrtc dash cast not working, default dash cast screen only. This is to gen 1 chromecast, was working days ago.. I have now got the same issue, was working perfectly until a day or so ago. Maybe the 2023.9 update broke it or maybe its just a coincidence. Everythign else casts fine from HA, dashboards, media, cameras etc only WebRTC isn't working — Reply to this email directly, view it on GitHub<#88 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEBCFUYND4W3OLNSOBOCRQLXZONQTANCNFSM46O46EAQ. You are receiving this because you commented.Message ID: @.>

Hi, I am casting using the following;

service: webrtc.dash_cast
data:
entity_id: media_player.nesthubmax
url: rtsp://frigateip:8554/Porch_sub

I can open the rtsp on VLC so its working. I just updated to 2023.9.1 and still not working

@atv2016
Copy link

atv2016 commented Sep 9, 2023 via email

@haroldboom
Copy link

Yeah just sits on DashCast screen with a HA URL. Attached,

Also debug logging doesnt show anything;
2023-09-09 18:10:44.502 DEBUG (SyncWorker_0) [custom_components.webrtc.utils] DashCast to media_player.nesthubmax
2023-09-09 18:10:56.945 DEBUG (SyncWorker_9) [custom_components.webrtc.utils] DashCast to media_player.nest_hub
2023-09-09 18:11:11.572 DEBUG (SyncWorker_8) [custom_components.webrtc.utils] DashCast to media_player.living_room_tv
unnamed

@atv2016
Copy link

atv2016 commented Sep 9, 2023 via email

@haroldboom
Copy link

haroldboom commented Sep 9, 2023 via email

@AlexxIT
Copy link
Owner

AlexxIT commented Sep 9, 2023

You can try to add force option. Latest version supports it

@haroldboom
Copy link

You can try to add force option. Latest version supports it

Tried the force option and still no good. Something isn't right with the embedded URL because it wont open even on my laptop browser (chrome)

@AlexxIT
Copy link
Owner

AlexxIT commented Sep 9, 2023

This url can be opened only once.

@haroldboom
Copy link

haroldboom commented Sep 9, 2023 via email

@atv2016
Copy link

atv2016 commented Sep 9, 2023 via email

@haroldboom
Copy link

I added the RTSP feed as a generic camera integration and I’m casting that to my Nest as a work around but it sucks. Like 5 second delay

@atv2016
Copy link

atv2016 commented Sep 10, 2023 via email

@haroldboom
Copy link

haroldboom commented Sep 10, 2023

@atv2016 ah far out thanks mate, I used the GUI option to force but when I checked the yaml it wasn't there, working again now!

@AlexxIT Hey Alex thanks for you help, the issue was fixed by the force option but I had to write it into the yaml, the GUI checkbox option in the automation didnt work (it was still checked) but nothing in the yaml. Setting my yaml to below worked.

service: webrtc.dash_cast
data:
  url: rtsp://frigateip:8554/Driveway_sub
  entity_id: media_player.nesthubmax
  force: true
enabled: true

Thanks again for a great integration

@liulock
Copy link

liulock commented Nov 11, 2023

@atv2016 ah far out thanks mate, I used the GUI option to force but when I checked the yaml it wasn't there, working again now!

@AlexxIT Hey Alex thanks for you help, the issue was fixed by the force option but I had to write it into the yaml, the GUI checkbox option in the automation didnt work (it was still checked) but nothing in the yaml. Setting my yaml to below worked.

service: webrtc.dash_cast
data:
  url: rtsp://frigateip:8554/Driveway_sub
  entity_id: media_player.nesthubmax
  force: true
enabled: true

Thanks again for a great integration

This works good to me, thank you

@deezid
Copy link

deezid commented May 31, 2024

Also getting just a black screen on my Nest Hub 2 with player controls. Widget works fine and latency is below a second on dashboard...

@cgilis
Copy link

cgilis commented May 31, 2024

Did you update by any change your Unify Protect camera's?
If so turn the encoding back to standard under recording settings
CleanShot 2024-05-31 at 15 38 04@2x

@deezid
Copy link

deezid commented May 31, 2024

Using Reolink but just read that the Nest hub doesn't support the clear (2.5K) resolution :D
Trying to get a lower quality stream to work next.

@deezid
Copy link

deezid commented May 31, 2024

Did you update by any change your Unify Protect camera's? If so turn the encoding back to standard under recording settings CleanShot 2024-05-31 at 15 38 04@2x

Soo, the lower quality (sub) stream works flawlessly and the latency is ridiculously low! Really impressed.

@AlexxIT
Copy link
Owner

AlexxIT commented May 31, 2024

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

Successfully merging a pull request may close this issue.