Skip to content

Latest commit

 

History

History
22 lines (16 loc) · 751 Bytes

File metadata and controls

22 lines (16 loc) · 751 Bytes

Audio Hooks API Reference

useAudioNavigator

Provides access to the Readium AudioNavigator instance and all playback/navigation methods. See the Core Hooks API for the full interface reference.

Important

Import from @edrlab/thorium-web/audio when used alongside Stateful Components, not from @edrlab/thorium-web/core/hooks. All components must share the same navigator instance.

import { useAudioNavigator } from "@edrlab/thorium-web/audio";

const MyControls = () => {
  const { play, pause, isPlaying, seek } = useAudioNavigator();

  return (
    <button onClick={ () => isPlaying() ? pause() : play() }>
      { isPlaying() ? "Pause" : "Play" }
    </button>
  );
};