nstrayer / shinysense

A bunch of shiny modules that let shiny sense the world around it.
http://nickstrayer.me/shinysense
Other
206 stars 31 forks source link

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

Open matiasandina opened 4 years ago

matiasandina commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

matiasandina commented 4 years ago

Yes

On Fri, Mar 27, 2020, 12:23 Nick Strayer notifications@github.com wrote:

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nstrayer/shinysense/issues/48#issuecomment-605092381, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZF2N2QTBZSTSCTDZIYBK3RJTHHLANCNFSM4LQMBY3Q .

nstrayer commented 4 years ago

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 commented 4 years ago

Sounds good to me. For my application, this would only be a nice to have. I don't really want to push you to develop too much, I thought there may be others who might be interested and it could get to the top of the list someday.

Unfortunately I don't have any setup open to all via IP. For security reasons, my system only streams in the local network. If needed I can try to figure it out and give you access credentials to it via email.

On Mon, Mar 30, 2020, 10:37 Nick Strayer notifications@github.com wrote:

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?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nstrayer/shinysense/issues/48#issuecomment-606039183, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZF2N3OR552GDWXVK74ZQ3RKCVDVANCNFSM4LQMBY3Q .

nstrayer commented 4 years ago

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 commented 4 years ago

Unfortunately not, my application is a custom Flask application that I developed in python. It just streams to local IP network.

El mié., 1 abr. 2020 a las 11:14, Nick Strayer (notifications@github.com) escribió:

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?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nstrayer/shinysense/issues/48#issuecomment-607309151, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZF2N2B7VH7OHTGS4HCZIDRKNK33ANCNFSM4LQMBY3Q .