mirror of
https://github.com/zoriya/v10.git
synced 2026-08-11 08:29:47 +00:00
35 lines
996 B
JavaScript
35 lines
996 B
JavaScript
"use client";
|
|
import { createMediaButton } from "../create-media-button.js";
|
|
import { selectTime } from "@videojs/core/dom";
|
|
import { SeekButtonCore, SeekButtonDataAttrs } from "@videojs/core";
|
|
//#region src/ui/seek-button/seek-button.tsx
|
|
/**
|
|
* A button that seeks forward or backward by a configurable number of seconds.
|
|
*
|
|
* @example
|
|
* ```tsx
|
|
* <SeekButton seconds={-10} />
|
|
*
|
|
* <SeekButton
|
|
* seconds={30}
|
|
* render={(props, state) => (
|
|
* <button {...props}>
|
|
* {state.direction === 'backward' ? <RewindIcon /> : <FastForwardIcon />}
|
|
* </button>
|
|
* )}
|
|
* />
|
|
* ```
|
|
*/
|
|
const SeekButton = createMediaButton({
|
|
displayName: "SeekButton",
|
|
core: SeekButtonCore,
|
|
stateAttrMap: SeekButtonDataAttrs,
|
|
selector: selectTime,
|
|
action: (core, state) => core.seek(state),
|
|
hotkeyAction: "seekStep",
|
|
hotkeyValue: (props) => typeof props.seconds === "number" ? props.seconds : SeekButtonCore.defaultProps.seconds
|
|
});
|
|
//#endregion
|
|
export { SeekButton };
|
|
|
|
//# sourceMappingURL=seek-button.js.map
|