Skip to content

Add live video stream support to ring-adapter#5

Open
dickydoouk wants to merge 12 commits into
damooooooooooh:masterfrom
dickydoouk:master
Open

Add live video stream support to ring-adapter#5
dickydoouk wants to merge 12 commits into
damooooooooooh:masterfrom
dickydoouk:master

Conversation

@dickydoouk
Copy link
Copy Markdown

Uses streamVideo function of ring-client-api to start a live HLS stream.

This currently doesn't work using the default video viewer in WebThings due to limitations in the HLS library used.

Have opened this PR to get early feedback.

@damooooooooooh
Copy link
Copy Markdown
Owner

Hi there, does this add a video stream property? Does it show the last video from the device? Thanks!

@dickydoouk
Copy link
Copy Markdown
Author

It adds a streaming property and an option to view the current live feed of the camera.

The streaming property must be set (Turned on) for the feed to be active.

image

But currently I get an error when viewing the stream. Caused by Shaka player not supporting m3u8. Im looking into creating a PR to switch to HLS.js but struggling to get that to work locally atm.

@damooooooooooh
Copy link
Copy Markdown
Owner

Hi, did you fix the issue related to this?

@dickydoouk
Copy link
Copy Markdown
Author

Still working on the viewing of the video feed from within webthings @damooooooooooh albeit slowly. Will keep this PR and you posted with progress?

@damooooooooooh
Copy link
Copy Markdown
Owner

No worries!

@dickydoouk
Copy link
Copy Markdown
Author

Screenshot 2021-08-05 at 00 29 44

Evidence of it working in Chrome

@damooooooooooh
Copy link
Copy Markdown
Owner

damooooooooooh commented Aug 5, 2021

Hi this doesnt work for me. Error: Ffmpeg is not installed. How do we bundle the dependency?

Also, for my Floodlight camera, the streaming properties are not generated as the data.features object doesn't have the show_vod_settings property......

2021-08-05 13:57:10.408 INFO : ring-adapter: { motion_zone_recommendation: false,
2021-08-05 13:57:10.409 INFO : ring-adapter: motions_enabled: true,
2021-08-05 13:57:10.410 INFO : ring-adapter: show_recordings: true,
2021-08-05 13:57:10.411 INFO : ring-adapter: advanced_motion_enabled: false,
2021-08-05 13:57:10.412 INFO : ring-adapter: people_only_enabled: false,
2021-08-05 13:57:10.413 INFO : ring-adapter: shadow_correction_enabled: false,
2021-08-05 13:57:10.415 INFO : ring-adapter: motion_message_enabled: false,
2021-08-05 13:57:10.416 INFO : ring-adapter: night_vision_enabled: false,
2021-08-05 13:57:10.417 INFO : ring-adapter: rich_notifications_eligible: true,
2021-08-05 13:57:10.418 INFO : ring-adapter: show_24x7_lite: true,
2021-08-05 13:57:10.419 INFO : ring-adapter: show_offline_motion_events: false,
2021-08-05 13:57:10.420 INFO : ring-adapter: cfes_eligible: null,
2021-08-05 13:57:10.421 INFO : ring-adapter: sheila_camera_eligible: null,
2021-08-05 13:57:10.422 INFO : ring-adapter: sheila_camera_processing_eligible: null }

@dickydoouk
Copy link
Copy Markdown
Author

I have tested this both on my ubuntu dev machine and my raspberry pi running webthings and it does view the camera feed these probably have ffmpeg pre-installed. As the ring-adapted depends on ring-client-api it should download and install ffmpeg-for-homebridge. I get the following message when running npm install which webthings should do on add-on installation:

ffmpeg has been downloaded to /home/pi/.webthings/addons/ring-adapter/node_modules/ffmpeg-for-homebridge/ffmpeg
Thank you for using https://github.com/homebridge/ffmpeg-for-homebridge

With regards the other issue: I only have the ring doorbell and don't own a ring floodlight camera so won't be able to fix that without some assistance. how did you list the ring-adapter properties. Maybe there is a better property we can use than show_vod_settings e.g. show_recordings

@damooooooooooh
Copy link
Copy Markdown
Owner

What platform do you build on?

@dickydoouk
Copy link
Copy Markdown
Author

I build on an Ubuntu Linux dist and also have a raspberry pi with stock webthings image and checkout the ring addon directly from my fork. I would imagine if you are building on a mac/windows machine that ffmpeg is not installed by default.

@damooooooooooh
Copy link
Copy Markdown
Owner

damooooooooooh commented Feb 8, 2022

Got this working, just replaced the ffmpeg binary with raspbian one. Quick question, will this stream indefinitely and consume disk space?

Also, for some reason, my ring floodlight doesnt return hasCamera as true.

ring-device.js --> Is this required?
this.hasCamera = camera.data.features &&
camera.data.features.show_vod_settings;

@dickydoouk
Copy link
Copy Markdown
Author

Glad you got it working. yes the stream will auto stop after 5 minutes to conserve data & battery. So isn't that useful to view the stream over longer periods of time. But this could be made configurable in the future for those who want it.

As for the ring floodlight unfortunately I do not possess one so am unable to test the properties of this device with the camera but hopefully its interface is similar to that of the doorbells.

@dickydoouk
Copy link
Copy Markdown
Author

Is there anything else that prevents this PR from being merged to master?

@damooooooooooh
Copy link
Copy Markdown
Owner

damooooooooooh commented Feb 27, 2022 via email

@dickydoouk
Copy link
Copy Markdown
Author

Any chance this could be merged yet? I don't have write access.

@damooooooooooh
Copy link
Copy Markdown
Owner

damooooooooooh commented Apr 17, 2022

We need to package this in accordance with the guidelines here with binaries. What platform are you running your version on? linux x64? Im running on arm so the binary differs.

The main issue here is around dependencies, ring-api-client has the ffmpeg-for-homebridge as a dependency which in turn has an install script that detects the build platform and includes the relevant ffmpeg binary. This is no good as webthings packages use the sha256 signature so package cannot be modified post install. We need to create a build for each platform supported and build separately

@damooooooooooh
Copy link
Copy Markdown
Owner

damooooooooooh commented Apr 18, 2022

Hi, can you pull my updates and build locally (package.sh). Will now produce linux-x64 package that you should install and test. Please check how the stream property now behaves e.g. the Video property is removed if the stream property is false.

@dickydoouk
Copy link
Copy Markdown
Author

Appreciate this is nearly 2yrs ago but I've rebased this pull-request and all seems working on my setup.

@damooooooooooh
Copy link
Copy Markdown
Owner

Hey I'm happy to make you a co-owner as I don't use the platform anymore.

@dickydoouk
Copy link
Copy Markdown
Author

Thanks much appreciated

@dickydoouk
Copy link
Copy Markdown
Author

dickydoouk commented Mar 7, 2024 via email

@damooooooooooh
Copy link
Copy Markdown
Owner

Hi what platform are you running on? The lastest ring-api-client (12.1.0) on my side is failing to load, potentially related to ECMAScript2020 on the webthings image. Did you having similar issues?

/home/node/.webthings/addons/ring-adapter/node_modules/ring-client-api/lib/api.js:131
ERROR : ring-adapter: devicesById[id]?.processPushNotification(notification);

SyntaxError: Unexpected token '.'

@dickydoouk
Copy link
Copy Markdown
Author

dickydoouk commented Mar 8, 2024 via email

@damooooooooooh
Copy link
Copy Markdown
Owner

I will be issuing a pull request to you PR in the next day. I installed this and noticed few issues with a few of my Ring devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants