function love.load()
local sound = love.audio.newSource("sound.ogg")
sound:play()
sound:seek(1)
end
Love: sound will be played from 00:01.
Punchdrunk: sound will be played from 00:00, the following error will occur (Chrome).
Error: Failed to set the 'currentTime' property on 'HTMLMediaElement': The element's readyState is HAVE_NOTHING.
at Error (native)
at Love.Audio.Source.Source.seek (http://localhost:8000/js/punchdrunk.js:9558:43)
at call (http://localhost:8000/js/punchdrunk.js:1855:17)
at shine.Closure._executeInstruction (http://localhost:8000/js/punchdrunk.js:1216:12)
at shine.Closure._run (http://localhost:8000/js/punchdrunk.js:1154:17)
at shine.Closure.execute (http://localhost:8000/js/punchdrunk.js:1055:15)
at result (http://localhost:8000/js/punchdrunk.js:981:14)
at shine.Function.apply (http://localhost:8000/js/punchdrunk.js:2265:29)
at shine.Function.call (http://localhost:8000/js/punchdrunk.js:2246:14)
at Love.Love.run (http://localhost:8000/js/punchdrunk.js:7835:17)
[object Object],9
According to the current state of standard, property currentTime of HTMLMediaElement can be set before audio metadata is loaded. But current versions of Chrome (issue) and Firefox (as far as I can say) do not implement this feature. I didn't test other browsers.
This is not an issue of punchdrunk by itself, but occurring error breaks an otherwise running game.
3 doesn't solve this issue. Possible workarounds are:
Avoid using seek at all.
Buffer seek calls until "loadedmetadata" event is received, and then apply buffered calls (according to W3C and Mozilla).
Test case:
Love: sound will be played from 00:01. Punchdrunk: sound will be played from 00:00, the following error will occur (Chrome).
According to the current state of standard, property currentTime of HTMLMediaElement can be set before audio metadata is loaded. But current versions of Chrome (issue) and Firefox (as far as I can say) do not implement this feature. I didn't test other browsers.
This is not an issue of punchdrunk by itself, but occurring error breaks an otherwise running game.
3 doesn't solve this issue. Possible workarounds are: