No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

Article

Playing Music Videos

Integrate Music Videos for playback in your website.


Overview

There are two ways to specify a video container.

  1. Adding an element with an id of apple-music-video-container
<div id="apple-music-video-container"></div>
  1. Assigning an element to the videoContainerElement property on the MusicKit instance
const music = MusicKit.getInstance();
const el = document.getElementById('some-element-id');

music.videoContainerElement = el;

With a video container set, music videos can be queued and played like any other content type

const music = MusicKit.getInstance();

await music.setQueue({ musicVideo: '1565280313' });
await music.play();
For more information, see Music Videos.