FrameworkStyle

Poster

Poster image component that stays visible until playback starts

Anatomy

Import the component:

<Poster src="poster.jpg" alt="Video preview" />

Examples

Basic Usage

import { createPlayer, features, PlayButton, Poster, Video } from '@videojs/react';

import './BasicUsage.css';

const Player = createPlayer({ features: [...features.video] });

export default function BasicUsage() {
  return (
    <Player.Provider>
      <Player.Container className="poster-basic">
        <Video src="https://stream.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/highest.mp4" playsInline />

        <Poster
          className="poster-basic__poster"
          src="https://image.mux.com/lhnU49l1VGi3zrTAZhDm9LUUxSjpaPW9BL4jY25Kwo4/thumbnail.jpg"
        />

        <PlayButton
          className="poster-basic__button"
          render={(props, state) => <button {...props}>{state.paused ? 'Play' : 'Pause'}</button>}
        />
      </Player.Container>
    </Player.Provider>
  );
}

API Reference

State

State is accessible via the render, className, and style props.

Property Type
visible boolean

Data attributes

Attribute Description
data-visible -
VideoJS