MusicKit v3 previewOnly does nothing

The documentation states that setting this property to true makes the player only play previews, even when authorization is available.

I am using it like this:

async function playPreview(songId) {
    const music = window.MusicKit.getInstance();
    music.previewOnly = true;
    await music.setQueue({song: songId, startPlaying: true});
}

This still makes the entire song play.

I have cross-checked that I am indeed loading MusicKit v3 (MusicKit.version returns '3.2226.3-prerelease'). Is the documentation wrong here, or am I missing something?

I investigated the MusicKit JS code and found a workaround!

For anyone wondering: the internal function playMediaItem checks not only the property previewOnly but also if the media item has a previewURL. When I pass in the ID of a library song (e.g. 'i.eEmBTAWEMr9'), this check fails. When I pass in a catalog ID obtained from song.attributes.playParams.catalogId (e.g. '1313047951') the check completes and the player correctly plays just the preview.

This is still unexpected behavior and I would expect this either to be mentioned in the documentation or to be changed in MusicKit so the player checks for the catalogId itself.

MusicKit v3 previewOnly does nothing
 
 
Q