Is it possible to use/adapt shinyviewr to listen to IP instead of camera?
Opened this issue · 8 comments
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
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.
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.
I see, so the important part is the streaming video part, not the camera access?
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?
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?