Video:seek() doesn't appear to work in reverse

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
NotExplosive
Prole
Posts: 8
Joined: Sun Jun 11, 2017 9:22 pm
Contact:

Video:seek() doesn't appear to work in reverse

Post by NotExplosive »

When I use seek() on a video to playback a part of the video I already saw, it doesn't appear to work. What happens is the audio resets to the correct point, but the video playback freezes. Usually it unfreezes once the audio catches back up to where the video moved from.

Anyone else seen this? Is there a workaround?
Play my games >> http://notexplosive.net <<
robd
Prole
Posts: 2
Joined: Sun Jul 07, 2024 3:08 pm

Re: Video:seek() doesn't appear to work in reverse

Post by robd »

Same issue here! I'm trying to map the mouse position to a number of seconds, to scrub through a video. It works, as long as I keep moving the mouse to the right. If I move the mouse to the left at all, the video stops playing until I move it past the play point again.

Code: Select all

function love.load()
    video = love.graphics.newVideo("movie.ogg") -- 30 sec
    video:play()
    w = love.graphics.getWidth()
end

function love.draw()
    love.graphics.draw(video, 0, 0)
end

function map(x, in_min, in_max, out_min, out_max)
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
end

function love.mousemoved( x, y, dx, dy, istouch )
  secs = map(x, 0, w, 0, 30)
  video:seek(secs)
  video:play()
end
Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot] and 3 guests