Open muschellij2 opened 5 years ago
I have some rough code for recording frames of a web page using chromote:
library(chromote)
b <- ChromoteSession$new(width = 480, height = 360)
frames <- list()
cancel_save_screencast_frames <- b$Page$screencastFrame(callback_ = function(value) {
frames[[length(frames) + 1]] <<- value
cat(".")
})
b$Page$navigate("http://giphygifs.s3.amazonaws.com/media/73FzKOYDpp7VK/giphy.mp4")
b$Page$startScreencast(format = "png", everyNthFrame = 2)
# Stop after 6 seconds
later(
function() {
b$Page$stopScreencast()
cancel_save_screencast_frames()
lapply(seq_along(frames), function(i) {
writeBin(jsonlite::base64_dec(frames[[i]]$data), sprintf("frame%02d.png", i))
})
b$close()
message("done")
},
6
)
I've been playing around with https://github.com/romainfrancois/rsciinema @romainfrancois and we've been able to get an asciicast to an GIF with the help of
asciicast2gif
, see (https://github.com/romainfrancois/rsciinema/issues/11 for an example).As
asciicast2gif
relies mainly on PhatomJS (https://github.com/asciinema/asciicast2gif/blob/master/src/asciinema/gif/main.cljs#L156) (but to be fair a lot of other JS/node), I was wondering if it'd be possible to usermdshot
but have it take multiple shots over time or a range of time.Example below
Here we create an
asciicast
which can has an RMarkdown/Shiny output object that will render when put in anRmd
. The output willSetting multiple files for
rmdshot
/webshot
did not achieve the results we're looking for. Just wanted to know if any insight possible or if a better approach would be to hack theasciicast2gif
JS to it's core, then use the PhantomJS install fromwebshot
.