audio5js icon indicating copy to clipboard operation
audio5js copied to clipboard

Instance attribute 'position' is a formatted string.

Open ErikAGriffin opened this issue 9 years ago • 1 comments

I think this is incorrect. The API should return the current playhead and seconds and leave it to the implementation to interpret this as they will. Getting the position as a number in seconds is useful as it allows one to easily write a 'seek' method, something like: audio5.seek(audio5.position+4.0) Currently one must use the somewhat absurd audio5.seek(audio5.audio.audio.currentTime+4.0) in order to achieve the same result.

I can do work on the fix myself I just wanted your thoughts first. In order to not break backwards compatibility, we could leave the position attribute and add a separate instance attribute such as playhead

ErikAGriffin avatar Jan 27 '16 22:01 ErikAGriffin

@ErikAGriffin check out the format_time config variable (which defaults to true) - it should do the trick, i think

zohararad avatar Jan 28 '16 10:01 zohararad