Gives GlobalPlayer the tracklist and transport of a YouTube playlist embed, whose list stays inside the iframe. The titles and lengths come from the server, since the embed exposes neither; the order, the position and the controls come from the IFrame Player API. Without the API (script blocked, embedding restricted) the rows are inert; without the server's list they have no titles.
Returns the tracklist and transport of the playlist embedUrl plays in the
iframe iframeRef, or no rows when it plays none. The iframe's URL must
carry enablejsapi (see withJsApi) for the API to drive it.
A row of the tracklist GlobalPlayer shows. Its title and length come from the server's list, and are missing for a video that list lacks.
-
duration: number
In seconds.
- title: string
- videoId: string
Returned by useYouTubePlaylist to GlobalPlayer, which shows the tracklist and its transport when there is more than one row.
-
index: number
The playing row, or -1 while the player hasn't reported one.
- next(): void
- playAt(index: number): void
- previous(): void
-
ready: boolean
Whether the IFrame API drives the embed. Rows are clickable only then.
- rows: PlaylistRow[]
Usage
import * as mod from "src/hooks/player/useYouTubePlaylist.ts";