The currentTime set to a value > 0 and < 1s is not working, it will always be 0.
Current Behavior:
The currentTime set to a value > 0 and < 1s is not working, it will always be 0. Cases:
- When I preview the video frame by frame, it will not working in the first second.
- When I want to get some thumbnails in the first second, it will always get the 0s as snapshot.
Expected Behavior:
The currentTime should be what I set if it is a valid value.
Steps To Reproduce:
- use a demo video with scene change in the first second
- set the current time,
player.currentTime = 0.5orremote.seek(0.5) - see the if the preview has changed
Environment:
- Framework: React
- Node: 20.0.0
- Chrome Version 131.0.6778.109 (Official Build) (arm64) Model Name: MacBook Pro Model Identifier: Mac15,3 Model Number: Z1C80004ECH/A Chip: Apple M3 Total Number of Cores: 8 (4 performance and 4 efficiency) Memory: 16 GB System Firmware Version: 11881.41.5 OS Loader Version: 11881.41.5
Anything Else?
I am facing the same issue. currentTime automatically sets to 0 when I set it under 1 second.
Confirmed to have the same issue.
This seems to come from this logic here: https://github.com/vidstack/player/blob/01ba2f29a08d035615678adf1e170e1e44a72c38/packages/vidstack/src/core/state/media-request-manager.ts#L770
This seems by design, but can't find any documentation about this behavior. Notice it will also happen on seeking within the last 1 nominal second of the clip.
I'm not sure yet if there is a decent way around this.
This is still a major issue. Is this package still being maintained?
Any updates regarding this issue, I'm also running into problems caused by this.
Also having this issue trying to seek frame by frame on a 10fps video. It would be nice to be able to disable the boundTime behavior. I'm using web components, but listening for the media-seek-request event, and when the seekTime is between 0 and 1, preventing the default behavior and handling the seek on the video element manually seems to be a viable workaround for bounding at the start of the video. Something like this:
videoPlayer.addEventListener('media-seek-request', (e) => {
const seekTime = e.detail;
if (seekTime > 0 && seekTime < 1) {
e.preventDefault();
let videoElement = videoPlayer.querySelector('video');
if (videoElement) {
videoElement.currentTime = seekTime;
}
}
});
Working around the end of the video is even more hacky. Best I could manage was adding a buffer second to the duration of the video, preventing seeking/playing past the true end of the video, and manually translating the slider to account for the buffer on time-update.
Working around the end of the video is even more hacky. Best I could manage was adding a buffer second to the duration of the video, preventing seeking/playing past the true end of the video, and manually translating the slider to account for the buffer on time-update.
Hey @jackcmac, can you share this approach with code? The seektime hack for 0 to 1 works and was helpful, thanks!
This worked as a hack for me, solving both the 0 to 1 issue and the video playing again from start after ended issue.
onMediaSeekRequest={(seekTime, e) => {
if (props.clipStartTime || props.clipEndTime) return;
e.preventDefault();
player?.$state.ended.set(false);
const playerVideoElement = player?.$el?.querySelector('video') as HTMLVideoElement;
if (playerVideoElement) {
playerVideoElement.currentTime = seekTime;
}
}}
Edit: This is breaking the currentTime state from useMediaState if clipStartTime and clipEndTime has been given.