Info panel

A panel about the video, with its artwork, details, description, and credits.

import { info } from "react-video-kit/info";

Adds 1.0 KB to a player2.2 KB on its ownSource

Adds an i button beside the settings menu, which opens a panel about the video.

0:00−0:000:00

Usage

tsx
import { info } from "react-video-kit/info";import { VideoPlayer } from "react-video-kit/player";const plugins = [  info({    eyebrow: "Nature",    title: "The Long Coast",    artwork: "/artwork.jpg",    facts: ["2024", "TV-PG", "1h 20m"],    description: "A year along one of the most remote coastlines on Earth.",    credits: [      { role: "Directed by", names: "A. Rivera" },      { role: "Written by", names: ["A. Rivera", "J. Okafor"] },    ],  }),];<VideoPlayer src="/video.mp4" plugins={plugins} />;

Every option is optional, and whatever you leave out doesn't render. facts is joined into one line. The description can be as long as it needs to be, because the panel scrolls.

To name the video on the player itself, use title, eyebrow, and description too. They're separate because this plugin is only loaded by players that want a panel.

With a playlist

Whatever isn't given here comes from the current playlist item: its title, eyebrow, description, and its thumbnail or poster as the artwork. So details that belong to the whole series can go here, and the rest stays on each item:

tsx
const plugins = [playlist({ items }), info({ facts: ["2024", "TV-PG", "6 episodes"] })];

Change what it shows

setInfo replaces everything on the panel, for details that load later:

tsx
player.plugin(info).commands.setInfo({ title: "The Long Coast", facts: ["2024"] });

Place the parts yourself

VideoPlayer places the button and the panel through slots. When you compose your own layout, put them wherever you like:

tsx
import * as Video from "react-video-kit";import { InfoButton, InfoPanel } from "react-video-kit/info";<Video.Root src="/video.mp4" plugins={plugins}>  <Video.Media />  <InfoPanel />  <Video.Controls>    <Video.PlayPause />    <InfoButton />  </Video.Controls></Video.Root>;

Behaviour

  • Playback carries on behind the panel, and the other controls step aside until it closes.
  • Focus moves to the text, so the arrow keys scroll it. The hotkeys plugin ignores keys pressed inside, and the idle plugin doesn't hide anything while it's open.
  • Esc and the close button close it, and focus goes back to the button that opened it.
  • It closes when the source changes, since what's on it was about the last video.
  • The artwork doesn't show on small players, where it would crowd the text.
  • Nothing renders until it first opens.
  • The root has data-info-open while it's open.

API

Options

OptionTypeDescription
title?stringThe video's name.
eyebrow?stringA short line above the title, such as a series or an episode.
description?stringWhat the video is about. It can be as long as it needs to be, because the panel scrolls.
artwork?stringAn image to show beside the text.
facts?readonly string[]Short details on one line, such as the year, rating, and running time.
credits?readonly InfoCredit[]Who made it.

State

Read it with useVideoState(info, (state) => …).

FieldTypeDescription
openbooleanTrue while the panel is showing.
contentInfoContentWhat the panel shows.

Commands

Call them with useCommands(info).

CommandTypeDescription
open() => voidOpens the panel.
close() => voidCloses the panel, and returns focus to its button.
toggle() => voidOpens the panel if closed, and closes it if open.
setInfo(content: InfoContent) => voidReplaces what the panel shows.

Parts

PartDescription
InfoButtonOpens the panel.
InfoPanelThe panel. It renders nothing until it first opens.