Skip to content

<sessions-embed>

A Spotify, Apple Music or YouTube player in a sandboxed frame.

Preact & React<Embed>GroupActionsDrawn asiframe

Preview

This element frames another site, so it has no static preview. Try it in your extension.

Drawn by the same renderers Sessions uses for your extension, from the DOM example beside it, without its event handlers.

When to use it

Frames a player — a playlist, a video — sandboxed, with autoplay and encrypted media allowed. Only these origins are framed: https://open.spotify.com, https://embed.music.apple.com, https://www.youtube.com and https://www.youtube-nocookie.com. Any other URL or scheme renders nothing (and logs a warning in development), because the frame sits inside a staff or signed-in buyer page. It grows open and fades in when src is set and collapses when src is removed, so keep the element mounted and change src.

In Preact and React, import the component of the same name from @sessions/apps/preact or @sessions/apps/react. Attributes become camelCase props, a boolean attribute is a boolean prop, and an event is an on prop that receives the event’s detail.

Attributes

Attribute
src
The player URL to frame, on one of the allowed origins.Prop src
height
The frame height in CSS pixels. Default 320.Prop height
title
An accessible name for the frame.Prop title
Example
import {Embed} from '@sessions/apps/preact';

<Embed
  src={id ? `https://open.spotify.com/embed/playlist/${id}` : undefined}
  height="480"
  title="Spotify"
/>

In the same group