How do I embed Spotfiy Artist or Playlist in Shiny APP

Viewed 40

I want to embed a Spotify Artist into a Shiny app that I am building. I have copied the artist's embed code from Spotify as shown below:

<iframe style="border-radius:12px" src="https://open.spotify.com/embed/artist/3RwQ26hR2tJtA8F9p2n7jG?utm_source=generator" width="100%" height="380" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>

Now, I tried to embed it in my shiny app with the code below:

library(shiny)

ui <- navbarPage(title = "Player",
tabPanel(id = "tab",title = strong("The Temptations"),icon = icon("info-circle"),
                          sidebarLayout(sidebarPanel(),mainPanel(tags$iframe(style="border-radius:12px", src="https://open.spotify.com/embed/artist/3RwQ26hR2tJtA8F9p2n7jG?utm_source=generator", width="100%", height="380", frameBorder="0", allowfullscreen="", allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture", loading="lazy"))))),

server <- function(input,output,session){}

shinyApp(ui,server)

I am using the tags$iframe() function inside shiny to embed the artist. However, nothing displays in the app:

Please, any suggestions or advice will be greatly appreciated from anyone who has successfully embedded a Spotify player inside a shiny app. Thanks in anticipation of your help.

0 Answers
Related