[SOLVED] Using a video crashes Love

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
Smy
Prole
Posts: 3
Joined: Thu May 21, 2020 3:51 am

[SOLVED] Using a video crashes Love

Post 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.
Last edited by Smy on Mon May 25, 2020 6:33 am, edited 1 time in total.
tobiasvl
Prole
Posts: 29
Joined: Mon Oct 01, 2018 4:58 pm
Location: Norway
Contact:

Re: Using a video crashes Love

Post 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?
User avatar
4vZEROv
Party member
Posts: 126
Joined: Wed Jan 02, 2019 8:44 pm

Re: Using a video crashes Love

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

Re: Using a video crashes Love

Post by slime »

mp4 videos aren't supported by love - currently it only supports Ogg Theora (which normally has the .ogv extension).
Smy
Prole
Posts: 3
Joined: Thu May 21, 2020 3:51 am

Re: Using a video crashes Love

Post 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!
Smy
Prole
Posts: 3
Joined: Thu May 21, 2020 3:51 am

Re: Using a video crashes Love

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

Who is online

Users browsing this forum: Google [Bot] and 42 guests