# Is it possible to set up an automatic spotify player iframe from spotify link?

**URL:** https://meta.discourse.org/t/is-it-possible-to-set-up-an-automatic-spotify-player-iframe-from-spotify-link/145878
**Category:** Support
**Created:** [27 במרץ,‏ 2020,‏ 9:38pm UTC](https://meta.discourse.org/t/is-it-possible-to-set-up-an-automatic-spotify-player-iframe-from-spotify-link/145878 "2020-03-27T21:38:33Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![LofiZone.com](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lofizone.com/32/174548_2.png) [@LofiZone.com](https://meta.discourse.org/u/LofiZone.com)
#### Post date: [27 במרץ,‏ 2020,‏ 9:38pm UTC](https://meta.discourse.org/t/is-it-possible-to-set-up-an-automatic-spotify-player-iframe-from-spotify-link/145878/1 "2020-03-27T21:38:33Z")

</div>

My community is based around artists posting their music for others to hear.

When a user posts a soundcloud, the iframe works flawlessly. However it appears there is no auto-iframe for spotify tracks and playlists.

How should I go about setting this up if possible? I have all the embed codes from spotify but unsure how to set up in discourse.

Thank you!

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [27 במרץ,‏ 2020,‏ 11:49pm UTC](https://meta.discourse.org/t/is-it-possible-to-set-up-an-automatic-spotify-player-iframe-from-spotify-link/145878/2 "2020-03-27T23:49:14Z")

</div>

> [@LofiZone.com](#):
>
> When a user posts a soundcloud, the iframe works flawlessly. However it appears there is no auto-iframe for spotify tracks and playlists.

Soundcloud oneboxes work great with Discourse. For Spotify, if you add a Spotify link to a song or playlist to a Discourse post, it creates a onebox, but not a Spotify player.

You can allow users to add the Spotify embed code (iframe) to Discourse posts by adding `https://open.spotify.com/embed/` to your site’s `allowed iframes` site setting. This will create an audio player that lets users listen to 30 second snippets of tracks.

---

<div class="post-metadata">

### Author: ![LofiZone.com](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lofizone.com/32/174548_2.png) [@LofiZone.com](https://meta.discourse.org/u/LofiZone.com)
#### Post date: [27 במרץ,‏ 2020,‏ 11:57pm UTC](https://meta.discourse.org/t/is-it-possible-to-set-up-an-automatic-spotify-player-iframe-from-spotify-link/145878/3 "2020-03-27T23:57:15Z")

</div>

I will certainly look into making the iframe capability available to my users.

Is there any way to automatically convert regular Spotify links to the embedded iframe? I used invision power board for awhile and their software would create embeddables for a wide range of media services including spotify. However I understand their software is very expensive and not open source.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [28 במרץ,‏ 2020,‏ 12:06am UTC](https://meta.discourse.org/t/is-it-possible-to-set-up-an-automatic-spotify-player-iframe-from-spotify-link/145878/4 "2020-03-28T00:06:53Z")

</div>

> [@LofiZone.com](#):
>
> Is there any way to automatically convert regular Spotify links to the embedded iframe?

It is technically possible, but I’m not sure it’s something I’d want to rely on. As an example of how to do it, the Spotify link `https://open.spotify.com/track/39zWYYZStDgWi32sOU9AX4?si=BLFB8HxuQNC-OaHtwD_E4A` can be converted to an iframe by adding `/embed` to the link’s path and then using that URL as the iframe’s `src`:

`<iframe src="https://open.spotify.com/embed/track/39zWYYZStDgWi32sOU9AX4?si=BLFB8HxuQNC-OaHtwD_E4A"></iframe>`

---

<div class="post-metadata">

### Author: ![LofiZone.com](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lofizone.com/32/174548_2.png) [@LofiZone.com](https://meta.discourse.org/u/LofiZone.com)
#### Post date: [28 במרץ,‏ 2020,‏ 12:13am UTC](https://meta.discourse.org/t/is-it-possible-to-set-up-an-automatic-spotify-player-iframe-from-spotify-link/145878/5 "2020-03-28T00:13:27Z")

</div>

Good thinking, yes that appears that it would do the trick. Do you know what files I would need to edit to get such results? If I knew the file(s) I am confident I could code it in myself!

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [28 במרץ,‏ 2020,‏ 1:54am UTC](https://meta.discourse.org/t/is-it-possible-to-set-up-an-automatic-spotify-player-iframe-from-spotify-link/145878/6 "2020-03-28T01:54:41Z")

</div>

> [@LofiZone.com](#):
>
> Do you know what files I would need to edit to get such results?

If your Discourse site is self-hosted, I think the best approach would be to create a Spotify onebox plugin. If you open your web inspector on a Spotify page, you’ll see that the data you would need to create a Spotify player from an iframe exists in the page’s `meta` tags. You probably need to use key commands to open your web inspector. Spotify seems to block right clicks.

You can find examples of how oneboxes are created here: [GitHub - discourse/onebox: (DEPRECATED) A gem for turning URLs into website previews · GitHub](https://github.com/discourse/onebox).

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [8 באפריל,‏ 2024,‏ 11:11am UTC](https://meta.discourse.org/t/is-it-possible-to-set-up-an-automatic-spotify-player-iframe-from-spotify-link/145878/7 "2024-04-08T11:11:24Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [8 במאי,‏ 2024,‏ 11:12am UTC](https://meta.discourse.org/t/is-it-possible-to-set-up-an-automatic-spotify-player-iframe-from-spotify-link/145878/8 "2024-05-08T11:12:20Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
