Skip to content
FrameworkStyle

useMediaExtension

Hook for registering a custom extension with the current Player media adapter

Import

import { useMediaExtension } from "@videojs/react";

Usage

Build a React extension by passing its media extension class from a component rendered inside Player.

import { MuxDataExtension } from "@videojs/mux-data";
import { useMediaExtension } from "@videojs/react";

function CustomMuxData() {
  useMediaExtension(MuxDataExtension);

  return null;
}

The hook creates one instance, follows media changes, and destroys the extension on unmount. A plain <video> element is not a media-extension host, so registration is skipped for it.

API Reference

Parameters

ParameterTypeDefaultDetails
ExtensionClass*function

Return Value

Component