> ## Documentation Index
> Fetch the complete documentation index at: https://docs.beyondwords.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Video Player

> A video-enabled player example with floating widget mode.

> [tab] Preview

> [tab] Code
>
> ```html VideoPlayer.html theme={null}
> <bw-video-player-provider
>     data-project-id="54009"
>     data-content-id="5ab6a5e1-689c-4103-962d-e7e68a4258ff"
>     data-show-user-interface="false"
>     data-video="true"
> >
>   <bw-video-feature-image></bw-video-feature-image>
>   <bw-video-control-bar>
>     <bw-video-prev-seconds-button data-color="white" data-seconds="10"></bw-video-prev-seconds-button>
>     <bw-video-play-pause-button data-color="white" data-size="56"></bw-video-play-pause-button>
>     <bw-video-next-seconds-button data-color="white" data-seconds="10"></bw-video-next-seconds-button>
>   </bw-video-control-bar>
>   <bw-video-widget-bar>
>     <bw-video-play-pause-button></bw-video-play-pause-button>
>     <bw-video-widget-controls>
>       <bw-video-playback-rate-button></bw-video-playback-rate-button>
>       <bw-video-prev-seconds-button data-seconds="10"></bw-video-prev-seconds-button>
>       <bw-video-next-seconds-button data-seconds="10"></bw-video-next-seconds-button>
>       <bw-video-time-indicator></bw-video-time-indicator>
>       <bw-video-progress-bar></bw-video-progress-bar>
>       <bw-video-close-widget-button></bw-video-close-widget-button>
>     </bw-video-widget-controls>
>   </bw-video-widget-bar>
> </bw-video-player-provider>
> ```

## Installation

```bash npm theme={null}
npx @beyondwords/cli components add video-player --html
```

```bash pnpm theme={null}
pnpm dlx @beyondwords/cli components add video-player --html
```

```bash yarn theme={null}
yarn dlx @beyondwords/cli components add video-player --html
```

```bash bun theme={null}
bunx --bun @beyondwords/cli components add video-player --html
```

## Usage

Unlike the React block, there is no single `<bw-video-player>` element. Compose
the video custom elements inside a
[`<bw-video-player-provider>`](https://docs.beyondwords.io/components/html/player-provider) with
`data-video="true"`. Import the modules (each calls `customElements.define`),
then arrange the elements:

```html theme={null}
<bw-video-player-provider
  data-project-id="54009"
  data-content-id="5ab6a5e1-689c-4103-962d-e7e68a4258ff"
  data-show-user-interface="false"
  data-video="true"
>
  <bw-video-feature-image></bw-video-feature-image>

  <bw-video-control-bar>
    <bw-video-prev-seconds-button data-color="white" data-seconds="10"></bw-video-prev-seconds-button>
    <bw-video-play-pause-button data-color="white" data-size="56"></bw-video-play-pause-button>
    <bw-video-next-seconds-button data-color="white" data-seconds="10"></bw-video-next-seconds-button>
  </bw-video-control-bar>

  <bw-video-widget-bar>
    <bw-video-play-pause-button></bw-video-play-pause-button>
    <bw-video-widget-controls>
      <bw-video-playback-rate-button></bw-video-playback-rate-button>
      <bw-video-prev-seconds-button data-seconds="10"></bw-video-prev-seconds-button>
      <bw-video-next-seconds-button data-seconds="10"></bw-video-next-seconds-button>
      <bw-video-time-indicator></bw-video-time-indicator>
      <bw-video-progress-bar></bw-video-progress-bar>
      <bw-video-close-widget-button></bw-video-close-widget-button>
    </bw-video-widget-controls>
  </bw-video-widget-bar>
</bw-video-player-provider>

<script type="module">
  import "@/registry/html/blocks/video/PlayerProvider";
  import "@/registry/html/blocks/video/FeatureImage";
  import "@/registry/html/blocks/video/ControlBar";
  import "@/registry/html/blocks/video/PlayPauseButton";
  import "@/registry/html/blocks/video/PrevSecondsButton";
  import "@/registry/html/blocks/video/NextSecondsButton";
  import "@/registry/html/blocks/video/WidgetBar";
  import "@/registry/html/blocks/video/WidgetControls";
  import "@/registry/html/blocks/video/PlaybackRateButton";
  import "@/registry/html/blocks/video/TimeIndicator";
  import "@/registry/html/blocks/video/ProgressBar";
  import "@/registry/html/blocks/video/CloseWidgetButton";
</script>
```

The provider renders a rounded frame, 536px wide with a 16:9 aspect ratio.
`<bw-video-control-bar>` overlays its controls (skip back, play/pause, skip
forward) on the feature image / video surface. While playing and scrolled out
of view, `<bw-video-widget-bar>` appears as a floating mini-widget with compact
controls.

For portrait video, set `data-aspect="9/16"` and `data-height="480"` on the
provider. See [Vertical Video Player](https://docs.beyondwords.io/components/html/vertical-video-player.md).

> [!WARNING]
>
> These components expect the BeyondWords player to be available as a global
> `BeyondWords` (the player UMD script). Load it before the provider connects.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.