Plays a link's preview in the global player, as the provider's embed or as a queue of Bandcamp streams. RichContentCard and JournalCard call it when their thumbnail is clicked.

Functions

f
canPlayRichContent(rc: PlayableRichContent): boolean

Checks whether rc can be played, for the cards to offer a play button. In native mode a Bandcamp page plays even without an embed, since its streams are resolved from the page itself.

f
usePlayRichContent(): UsePlayRichContentResult

Returns a function that plays a link's preview in its provider's embed. When the deployment sets GERBEUR_BANDCAMP_PLAYER=native, a Bandcamp page is resolved into its mp3 streams instead and played as a queue, which autoplays and plays an album through. If that fails (offline, a preorder, Bandcamp changing its markup), the embed plays, and a page without one (an artist's root, a /music index) plays nothing.

Interfaces

I
PlayableRichContent

Passed to playRichContent and canPlayRichContent by RichContentCard and JournalCard. It is a dump's RichContent, its thumbnail replaced by the dump's own when it has one.

I
UsePlayRichContentResult

Returned by usePlayRichContent to the cards that play a link.