Coder Social home page Coder Social logo

cp2004 / octoprint-camerastreamer-control Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 0.0 307 KB

Embed WebRTC (& more) streams provided by camera-streamer in OctoPrint

License: GNU Affero General Public License v3.0

Python 28.52% JavaScript 35.49% Jinja 23.91% SCSS 5.65% CSS 6.42%

octoprint-camerastreamer-control's Introduction

Hey there πŸ‘‹

Here are some of my featured projects:

Recent releases πŸ”–

Supporting my projects

Enjoyed using a plugin? You can support their development through GitHub Sponsors. Sponsor monthly, one-time and choose a custom amount. You can choose!

❀️ Sponsor

octoprint-camerastreamer-control's People

Contributors

cp2004 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

octoprint-camerastreamer-control's Issues

Stream Timeout prevents camera-streamer to stop when browser tab or browser is closed.

Because the stopStream function is using the timeout when called from onWebcamVisibilityChange, the camera-streamer stream is not properly stopped when the user closes the browser tab or browser. (I'm testing in Chrome)

If the code in onWebcamVisibilityChange is changed to self.stopStream(true) (force the stop) or the stream timeout is set to 0 in the settings, everything works as expected.

How to reproduce:
Check CPU usage with top.

  1. switch from control tab to any other tab that isn't showing the cam (ex. temp)
    -> camera-streamer CPU usage falls bellow 1%
  2. switch back to control tab
    -> camer-streamer usage goes back up (depending on the settings, usually somewhere between 5% - 20%)
  3. close chrome tab or browser
    -> camera-streamer CPU usage stays up. Only way to bring it down is to restart the camera-streamer service.

πŸ“Œ Todo list & known issues

I'll try and keep track of the things I know are not implemented or broken in the plugin, so you know if you run into them

TODOs

  • Smoother settings UI
  • Timeout if webrtc hangs in loading
  • Remind user to disable 'Classic webcam' if they would like
  • Remind user to select 'Camera Streamer Control' as default webcam if not already
  • Expose parameters on the API to clients
  • Loading indicator for all stream types
    • WebRTC
    • Mjpg
  • Make strings translatable
  • Cache buster option

Known issues

  • Can't unload mjpg streams on safari, so work around
  • Reloads stream on every settings change
  • Stream unloads when scrolling down the page (Intersection Observer problem - fixed OctoPrint's side)
  • Flip/Rotate does not work on fullscreen/picture in picture - nothing I can do about this

Future features

  • Static snapshot stream type
  • HLS stream type

Multiple cameras support

Hi,

The only plugin I know of that currently allows you to use multiple cameras, Multicam, does not properly support webrtc streams with the new octopi camera stack.

Looking at the source codes, integrating support for the new camera stack into Multicam seems more complicated than supporting multiple cameras in CamerStreamer-Control.

Considering that the new camera streamer natively supports multiple cameras, could it be within the scope of this project to support multiple cameras too?

CanΒ΄t configure webrtc stream URL right

If I put the following URL in a new browser tab (firefox) it shows the webrtc stream in perfect quality:

http://192.168.0.222:8080/webrtc

Pleas note that it needs to be NOT https, and that it needs the ip adress of the raspberry pi/octoprint and the port number of the camera stream, followed by "webrtc".

When I try to configure this URL in your plugin I fail, because in your plugin the part: http://192.168.0.222/ (ip adress with a trailing slash) is hardcoded, so I canΒ΄t change it, and only can append something. So if I put :8080/webrtc in the field for the webcam URL it makes the following out of it:

http://192.168.0.222/:8080/webrtc

which will obviously not work, because it pus a hardcoded slash before the port number.
If the slash would not be hardcoded I would be able to put what I need here to get the right URL for the stream. Those who maybee need a slash here could put it manually, and get this to work this way.
The input similar to the ones you have now will change from

"webrtc" to "/webrtc"

same applies to the snapshot URL.
here I would need to get It to work (testet in a firefox tab):

http://192.168.0.222:8080/snapshot

If you put the following:

http://192.168.0.222:8080

you will get a list of functions for the new camera streamer. Every single option listed here works perfectly, as long as it has a leading string like:

http://(ip adress of octoprint/raspi):Port(/option)

and only this syle works, every else fails, despite the fallback to mjpeg stream.

Is it possible to change the hardcoded part in your plugin like so, that the trailing slash is not hardcoded anymore, and has to be put by the user, if necessary?
regards C

Doesn't work with go2rtc webrtc streams

The plugin doesn't seem to be able to handle mp4 webrtc streams generated by go2rtc streamer.

The webrtc url I have is of form:

http://mypi/api/stream.mp4?src=picam_h264

The stream plays just fine in my browser or in apps like mplayer and vlc.
But it fails to display in Octoprint-CameraStreamer-Control (where I selected 'WebRTC' as the Preferred Video Mode)

Any suggestions on troubleshooting this and making it work?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.