Embedded Audio Players in Jupyter Notebooks Running IRKernel
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
For ref, when running IRkernel Jupyter R notebooks, media objects can be embedded by making use of the shiny::tags
function, that can return HTML elements with appropriate MIME types, and are renderable using _repr_html
machinery (h/t @flying-sheep):
For example:
PS By the by, I notice the existence of another R kernel for Jupyter notebooks, JuniperKernel. An advantage of this over IRkernel is that it supports xwidgets
, a C++ widget implementation for Jupyter notebooks akin to ipywidgets
. (As far as I know, there isn’t a widget implementation for IRkernel, although maybe something can be finessed using shiny::tags
and other bits of shiny
machinery? ) Although I could install JuniperKernel
on my Mac, I had some issues getting it to work that I haven’t had a chance to explore yet, so I don’t yet have a widgets demo…
PS having to save an audio file to then load back into the player may be a faff; that said, it looks like there may be a route to using a data URI? Not tried this yet; if you have a short reproducible demo that works, please share via the comments:-)
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.