Page 1 of 2

video:isPlaying() still true after end of play

Posted: Tue Dec 22, 2015 8:00 pm
by crocmiam
Hello,

I tried the new video API with a short video but when the video has ended, video:isPlaying() still returns true. Is this expected?

Code: Select all

local video

function love.load()
  video = love.graphics.newVideo("video.ogv")
  video:play()
end

function love.update()
  print(video:isPlaying())
end

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

Re: video:isPlaying() still true after end of play

Posted: Wed Dec 23, 2015 4:11 pm
by slime
Thanks for the report! We'll try to fix it ASAP.

Re: video:isPlaying() still true after end of play

Posted: Wed Dec 23, 2015 7:56 pm
by portify
Is there any way to get the duration of a video?

Re: video:isPlaying() still true after end of play

Posted: Wed Dec 23, 2015 8:03 pm
by s-ol
portify wrote:Is there any way to get the duration of a video?
Kind of a hack but you should be able to get it from the audio Source with Source:getDuration() (you can get the source with video: get source()). This might of course not work if the video doesn't have an audio track and is a bit weird in general.

Re: video:isPlaying() still true after end of play

Posted: Wed Dec 23, 2015 8:35 pm
by bartbes
It turns out Ogg Theora is particularly awkward because it doesn't have any kind of length info or index. The love.video code could definitely use some cleanup, and apparently bugfixes, and could definitely use some more features. Consider it something for 0.10.1. Feature request welcome, though.

Re: video:isPlaying() still true after end of play

Posted: Tue Jan 05, 2016 2:04 pm
by Fenrir
I can confirm that I have the same problem! :) I need to make some videos to loop so I thought that rewinding them when this flag will go back to false should do the trick but it never comes back to false...

Re: video:isPlaying() still true after end of play

Posted: Tue Jan 05, 2016 2:09 pm
by bartbes
Might be interesting to verify: does the cpu usage increase? It might be that the video thread gets stuck decoding.

Re: video:isPlaying() still true after end of play

Posted: Tue Jan 05, 2016 2:58 pm
by crocmiam
bartbes wrote:Might be interesting to verify: does the cpu usage increase? It might be that the video thread gets stuck decoding.
Quick test: during playback, love uses ~10% of the CPU (as reported by htop on Ubuntu), after playback it decreases to ~5%.

Re: video:isPlaying() still true after end of play

Posted: Tue Jan 05, 2016 2:59 pm
by Fenrir
crocmiam wrote:
bartbes wrote:Might be interesting to verify: does the cpu usage increase? It might be that the video thread gets stuck decoding.
Quick test: during playback, love uses ~10% of the CPU (as reported by htop on Ubuntu), after playback it decreases to ~5%.
Same here, it decreases even more around 1-2%.

EDIT: testing on Windows 7 for me.

Re: video:isPlaying() still true after end of play

Posted: Tue Jan 05, 2016 4:55 pm
by bartbes
Even though it did mark as finished for me, closing love after did cause a hang, so I debugged that and I just committed a fix. That should also make sure isPlaying is false, but I couldn't confirm that.