Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sound not worked on Mobile Web #60

Open
andreymust19 opened this Issue May 15, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@andreymust19
Copy link

andreymust19 commented May 15, 2018

Example: https://gamejolt.com/claim/HSfptdX3
I hear music and sound when click and press 'space' if open this page on computer. And full silence on mobile (android). Browser: google chrome

CONF.LUA

function love.conf(t)
t.title = "TestHTML"
t.author = "AndreyMust19"
t.identity = "TestHTML"
t.version = "0.10.1"
t.console = false
t.window.width = 512
t.window.height = 512
t.window.fullscreen = false
t.window.vsync = false
t.window.fsaa = 2
t.modules.joystick = false
t.modules.audio = true
t.modules.keyboard = true
t.modules.event = true
t.modules.image = true
t.modules.graphics = true
t.modules.timer = true
t.modules.mouse = true
t.modules.sound = true
t.modules.physics = false
end

MAIN.LUA

lg = love.graphics
la = love.audio

local sound, music

function love.load()
sound = la.newSource("click.wav", 'static')
music = la.newSource("track1.mp3", 'stream')
music:setLooping(true)
music:play();
start()
end
local function real_update(dt)
end

local last_dt, last_fps
local max_dt = 0.05

function love.update(dt)
if (dt > max_dt) then dt = max_dt end
real_update(dt)
last_dt = math.floor(dt*1000000)
last_fps = math.floor(love.timer.getFPS())
end

function love.draw()
lg.printf("dt: "..last_dt, 20, 20, 100, 'left');
lg.printf("FPS: "..last_fps, 20, 40, 100, 'left');
end

function love.keypressed(key, unicode)
if (key == 'space' or key == ' ') then sound:play() end
end

function love.mousepressed(x, y, btn)
if (btn == 1) then sound:play() end
end

function love.quit()
end

@drmargarido

This comment has been minimized.

Copy link

drmargarido commented Feb 12, 2019

Try to put the track1 as static in the newSource call.
I have a flag for web builds which makes all the sounds static because the streaming of audios makes the games slower and sometimes it doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.