Laurynas Tamulevičius
Laurynas Tamulevičius

Reputation: 1589

Injecting audio track with a player to div

I was working with Spotify Web API and as a part of track retrieval response they provide url to 30 seconds track preview like this:

https://p.scdn.co/mp3-preview/c74432c268b6a5d0d7794e476023115b65e3105b?cid=b774e3bf851646c1b02928ea75802587

(MUSIC WILL START PLAYING IF YOU OPEN URL)

The browser detects that it's an audio file and displays the player.

Is there a way to inject this player container to a div somehow?

I tried the iframe, but it injects the whole window and I am only interested in the player component.

Upvotes: 0

Views: 100

Answers (1)

Chandra Kumar
Chandra Kumar

Reputation: 4205

You can try this code:

<video controls="" autoplay="" name="media"><source src="https://p.scdn.co/mp3-preview/c74432c268b6a5d0d7794e476023115b65e3105b?cid=b774e3bf851646c1b02928ea75802587" type="audio/mpeg"></video>

Upvotes: 1

Related Questions