SolidJSS
SolidJSโ€ข3mo agoโ€ข
6 replies
Optimum

mediakit/video - setting `currentTime`

Using mediakit, I'm trying to create a master seek bar that sets the percent duration for multiple videos, so I need to be able to control the currentTime of the video manually. Its createVideo hook returns a component that accepts its own props to pass to the underlying <video> element.

Example:
const { Video, play, pause, paused, canBeUnmuted, isVideoLoading } = createVideo({...})

return (
  <Video
    onLoadedMetadata={handleLoadedMetadata}
    onSeeked={handleSeek}
  />
)

Now I thought I could try passing currentTime as a prop, but it seems it is ignored. As far as I can tell, currentTime is handled by a ref inside of createVideo separately from the props that is not exposed.

Is there a "clean" method of controlling the current time of a video or a hacky way of getting the dom element manually and setting it in a way that informs Solid?
Any ideas are appreciated!
GitHub
A set of utilities to use with your Solid apps. Contribute to solidjs-community/mediakit development by creating an account on GitHub.
mediakit/packages/media/src/video/createVideo.tsx at e5dec83d4d8003...
Was this page helpful?