mirror of
https://github.com/love2d/love.git
synced 2026-08-20 04:30:09 +02:00
Do not error in newVideo when optionally loading audio with love.audio disabled (fixes #1206)
This commit is contained in:
@@ -352,13 +352,17 @@ function love.graphics.newVideo(file, loadaudio)
|
|||||||
local video = love.graphics._newVideo(file)
|
local video = love.graphics._newVideo(file)
|
||||||
local source, success
|
local source, success
|
||||||
|
|
||||||
if loadaudio ~= false then
|
if loadaudio ~= false and love.audio then
|
||||||
success, source = pcall(love.audio.newSource, video:getStream():getFilename())
|
success, source = pcall(love.audio.newSource, video:getStream():getFilename())
|
||||||
end
|
end
|
||||||
if success then
|
if success then
|
||||||
video:setSource(source)
|
video:setSource(source)
|
||||||
elseif loadaudio == true then
|
elseif loadaudio == true then
|
||||||
error("Video had no audio track", 2)
|
if love.audio then
|
||||||
|
error("Video had no audio track", 2)
|
||||||
|
else
|
||||||
|
error("love.audio was not loaded", 2)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
video:getStream():setSync()
|
video:getStream():setSync()
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user