Issues with the "music.setPosition()" method
After discovering music.setPosition( position ) on the API cheatsheet, I have found it not to be working as intended. The method resets the song to a position of 0ms regardless of the input.
Here is a quick demo I made showing the bug: https://microstudio.io/sticktrick/musicposbug/ZCHAU8TZ/
This is the code inside:
init = function()
// Music
myMusic = audio.playMusic("run")
posChanged = false
end
update = function()
// Change position of song when it passes 2 seconds
if myMusic.getPosition() > 3 and not posChanged then
posChanged = true
// THIS SHOULD BE SETTING THE MUSIC TO 10 SECONDS IN
myMusic.setPosition(10)
end
end
draw = function()
screen.clear()
screen.drawText("At the 3 second mark of the music, the position" 0, 20, 12, "#FFF")
screen.drawText("should be set to 10 seconds" 0, 10, 12, "#FFF")
screen.drawText("MUSIC POSITION (in seconds)" 0, -10, 12, "#FFF")
if myMusic.getPosition() > 0 or posChanged then
// Displaying current position (in seconds)
screen.drawText(myMusic.getPosition(), 0, -20, 12,"rgb(193,193,193)")
else
screen.drawText("Loading audio...", 0, -20, 12,"rgb(193,193,193)")
end
end
