Is it possible to link my button with the button of spotify embed player in react js?

23 views Asked by At

I want to make my button to play and pause the track, is it possible? I use iframe,but i don't know how to make the control button to it, maybe there are other ways.

<iframe
    className="w-50 absolute bottom-0 right-0"
    src={url}
    width="80%"
    height="100"
    frameBorder="0"
    allowFullScreen=""
    allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
    loading="lazy"
  />;

Also i have tried IFrameAPI. But i need to open this embeded component https://open.spotify.com/embed/track/${id}?utm_source=generator&theme=0. And it doesn't work with this url, and there is the error with the script.

window.onSpotifyIframeApiReady = (IFrameAPI) => {
    let element = document.getElementById("embed-iframe");
    let options = { uri: "spotify:episode:7makk4oTQel546B0PZlDM5" };
    let callback = (EmbedController) => {};
    IFrameAPI.createController(element, options, callback);
  };
0

There are 0 answers