video:isPlaying() still true after end of play

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.
crocmiam
Prole
Posts: 5
Joined: Tue Dec 22, 2015 7:54 pm

video:isPlaying() still true after end of play

Post 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
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post by slime »

Thanks for the report! We'll try to fix it ASAP.
User avatar
portify
Prole
Posts: 18
Joined: Sun Feb 15, 2015 10:15 pm
Location: Locating
Contact:

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

Post by portify »

Is there any way to get the duration of a video?
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

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

Post 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.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

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

Post 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.
User avatar
Fenrir
Party member
Posts: 222
Joined: Wed Nov 27, 2013 9:44 am
Contact:

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

Post 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...
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

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

Post by bartbes »

Might be interesting to verify: does the cpu usage increase? It might be that the video thread gets stuck decoding.
crocmiam
Prole
Posts: 5
Joined: Tue Dec 22, 2015 7:54 pm

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

Post 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%.
User avatar
Fenrir
Party member
Posts: 222
Joined: Wed Nov 27, 2013 9:44 am
Contact:

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

Post 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.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

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

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests