Page 1 of 1

Video Player audio

Posted: Sun Jan 24, 2021 10:21 pm
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

Re: Video Player audio

Posted: Sun Jan 24, 2021 11:16 pm
by dusoft
How about having separate audio and video tracks/files and controlling them separately?

Re: Video Player audio

Posted: Mon Jan 25, 2021 12:25 am
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.

Re: Video Player audio

Posted: Mon Jan 25, 2021 12:30 am
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.