import { MediaFilePlayer, type MediaFilePlaybackHandle, type MediaFilePlaybackOptions, type MediaFilePlayerHooks, } from "../media-playback/media-file-player.js"; /** * Options for `ProctoringClient.playAudioFile()`. See * {@link MediaFilePlaybackOptions} for the shared media surface; audio * adds nothing on top. */ export type AudioFilePlaybackOptions = MediaFilePlaybackOptions; export type AudioFilePlaybackHandle = MediaFilePlaybackHandle; interface AudioFilePlayerOptions extends MediaFilePlaybackOptions, MediaFilePlayerHooks {} export class AudioFilePlayer extends MediaFilePlayer { constructor(options: AudioFilePlayerOptions) { super(options, { kindPrefix: "audio-playback", mediaNoun: "Audio", createElement: createAudioElement, }); } } function createAudioElement(): HTMLAudioElement { if (typeof document === "undefined") { throw new Error("Audio playback is only available in a browser document"); } return document.createElement("audio"); }