Video Player audio

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
TheLegoSensei
Prole
Posts: 8
Joined: Tue Feb 18, 2020 8:06 am

Video Player audio

Post by TheLegoSensei »

I am attempting to desync a video and it's audio, and seek each part as I please. the method I've chosen to do this is to load two of the video, mute one, and don't draw the other. the problem though is when I try to change the seek on the audio-only one, then the video stops. if you change the seek with the video, then the audio stops. I've tried copying the video file (OGV) so it was loading two different files, but it still happens. any help highly appreciated!

this is all the code, in main.lua:
(right click to seek)

Code: Select all

function love.load()
	path = "video.ogv"
    	vid = love.graphics.newVideo(path)
	aud = love.graphics.newVideo(path)
	love.window.setMode(vid.getWidth(vid),vid.getHeight(vid))
	vid:play()
	aud:play()
	vid:getSource().setVolume(vid:getSource(),0)--mute video
end
 
function love.update(dt)
	if love.mouse.isDown(2) then
		vid:seek(440)
	end
	print(vid:tell())
end
 
function love.draw()
	love.graphics.draw(vid)
end
User avatar
dusoft
Party member
Posts: 635
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Video Player audio

Post by dusoft »

How about having separate audio and video tracks/files and controlling them separately?
TheLegoSensei
Prole
Posts: 8
Joined: Tue Feb 18, 2020 8:06 am

Re: Video Player audio

Post by TheLegoSensei »

dusoft wrote: Sun Jan 24, 2021 11:16 pm How about having separate audio and video tracks/files and controlling them separately?
I've duplicated the video file and tried use one for video and the other for audio, but nothing changed. I don't want to use a regular audio file, as I want to swap out what video I'm using frequently and I don't want to have to convert it every time.
TheLegoSensei
Prole
Posts: 8
Joined: Tue Feb 18, 2020 8:06 am

Re: Video Player audio

Post by TheLegoSensei »

upon further inspection, if I call play() on the video after I change the audio seek, then it will continue playing. like it's automatically pausing the video. so I guess this is resolved, though it's strange that it would mess with the other video without warning.
Post Reply

Who is online

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