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

Is it possible to use/adapt shinyviewr to listen to IP instead of camera? #48

Open
matiasandina opened this issue Mar 20, 2020 · 8 comments

Comments

@matiasandina
Copy link

matiasandina commented Mar 20, 2020

I like shinyviewr a lot, I have a system that listens to an IP stream (local network) and I was wondering if it's possible to adapt shinyviewr to listen to that.

My current alternative is to use an approach like embedding via iframe
https://stackoverflow.com/questions/33020558/embed-iframe-inside-shiny-app/33021018#33021018

@nstrayer
Copy link
Owner

Hi @matiasandina ,

As in, can you use shinyviewr to watch streaming video and send it into shiny for analysis? If so, right now it's not possible but should be doable with websockets. The streaming data request has come up a good bit so it may come about sooner rather than later though.

Let me know if you meant something else.

@matiasandina
Copy link
Author

Hi,
I'm sorry about the low quality question, I can't produce a reproducible example at the moment. But I can give you the general idea.

A table (df) with IP addresses of local machines that may or might not be streaming video in the local network (anybody in the network can log in with user and password to the machine's IP and port to see the stream).

The current approach is through a "View" button inside a datatable. The observeEvent for this button gets the "selected row", builds a url, and triggers the browseURL().

# video rendering ----
    observeEvent(input$select_button, {
        selectedRow <- as.numeric(strsplit(input$select_button, "_")[[1]][2])
        ip_target <- df[selectedRow, ] %>% pull("ip")
        # hardcoded port may crash
        port <- ":5000"
        # we need the http otherwise it doesn't work
        browseURL(paste0("http://", ip_target, port))
    })

This is functional, even better than the above mentioned iframe strategy.
The original idea was to maybe be able to embed the video using shinyviewr or a modification of it, so it targets this stream instead of the webcam.

@nstrayer
Copy link
Owner

I see, so the important part is the streaming video part, not the camera access?

@matiasandina
Copy link
Author

matiasandina commented Mar 27, 2020 via email

@nstrayer
Copy link
Owner

Hmm. This is certainly possible but not exactly what I envisioned shinyviewr for. One thing that may be possible is to build a simple HTML_Widget or r2d3 widget that just wraps the html canvas->video stream idea. The wiring of the camera to the video output was honestly about 3 lines of code.

Do you have any examples of open source streams that could be used for testing in the same way? E.g. a webcam with an open-to-all ip address?

@matiasandina
Copy link
Author

matiasandina commented Mar 30, 2020 via email

@nstrayer
Copy link
Owner

nstrayer commented Apr 1, 2020

Do you know if there are any general public facing webcams (like the eagle cams etc) that would have the same interface that the cameras you're looking to use do?

@matiasandina
Copy link
Author

matiasandina commented Apr 1, 2020 via email

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

No branches or pull requests

2 participants