Page 1 of 1

[SOLVED] Using a video crashes Love

Posted: Thu May 21, 2020 4:07 am
by Smy
Hey guys!
So I've noticed lately that whenever I try to incorporate a video into my code, Love decides to crash completely. And I'm not talking about a blue screen error, I'm talking about a "Love.exe has stopped responding." I've looked all over the internet and I couldn't find a solution, as well as tried out using many different videos. Here's an example of a code that causes it to crash:

Code: Select all

mTimer = 0

function love.load()

	love.window.setMode(1280, 720)

	Loading = love.graphics.newVideo('Loading.mp4')

end

function love.update(dt)

	Mtimer = Mtimer + dt

	if Mtimer < 10 then
		Loading:play()
	end

	if Mtimer > 10 then
		Loading:stop()
	end

end

function love.draw()

	love.graphics.draw(Loading, 10, 10)

end
Any help would be greatly appreciated! I can also send any info if needed.

Re: Using a video crashes Love

Posted: Thu May 21, 2020 8:57 pm
by tobiasvl
Not sure if this is the problem, but don't you want to check Video:isPlaying() in those if tests, so it only starts playing if it's not playing, and is only stopped if it's playing?

Re: Using a video crashes Love

Posted: Thu May 21, 2020 10:43 pm
by 4vZEROv
You are calling loading:play() every time love.update is called, it's called a lot of time.

Do something like that

Code: Select all

function love.load()
    loading = love.graphics.newVideo('Loading.mp4')
    loading:play()
end

function love.update(dt)
    timer = timer + dt

   if timer > 10 and loading:isPlaying() then
       loaing:stop()
   end
end

Re: Using a video crashes Love

Posted: Fri May 22, 2020 12:47 am
by slime
mp4 videos aren't supported by love - currently it only supports Ogg Theora (which normally has the .ogv extension).

Re: Using a video crashes Love

Posted: Fri May 22, 2020 9:04 am
by Smy
4vZEROv wrote: Thu May 21, 2020 10:43 pm You are calling loading:play() every time love.update is called, it's called a lot of time.

Do something like that

Code: Select all

function love.load()
    loading = love.graphics.newVideo('Loading.mp4')
    loading:play()
end

function love.update(dt)
    timer = timer + dt

   if timer > 10 and loading:isPlaying() then
       loaing:stop()
   end
end
Oh yeah! Don't know what I was thinking programming it like that :P Thanks for the suggestion!

Re: Using a video crashes Love

Posted: Fri May 22, 2020 9:05 am
by Smy
slime wrote: Fri May 22, 2020 12:47 am mp4 videos aren't supported by love - currently it only supports Ogg Theora (which normally has the .ogv extension).
Aw, that's a shame. Thanks for letting me know though! I'll try to find a work around where I can use an .ogv video rather than a .mp4 one.