Reads, prepares and lists YouTube playlist embeds, for GlobalPlayer and useYouTubePlaylist to show and drive a playlist's tracklist.
f
embedListId(embedUrl: string): string | null
Returns the id of the playlist embedUrl plays, or null. It reads both
shapes the server's YouTube embeds take, /embed/videoseries?list=… for a
bare playlist and /embed/<id>?list=… for a video opened in one.
f
fetchPlaylistTracks(listId: string): Promise<YouTubePlaylistTrack[]>
Returns the titles and lengths of the videos of playlist listId, from
GET /api/remote/youtube, since the embed exposes neither.
f
withJsApi(url: string): string
Returns url with the parameters the IFrame Player API needs to drive the
embed. enablejsapi can't be turned on after the iframe loads, so
GlobalPlayer adds it to every playlist embed, whether or not the API script
loads.
Usage
import * as mod from "src/utils/player/youtube.ts";