Fileplayer callback issues

When playing around with the Fileplayer, I noticed some inconsistent (and/or undocumented) behaviour:

  • :setLoopCallback() triggers too early, not at the end of the file like :setFinishCallback() does. The exact time seems to be affected by :setBufferSize(), so I suspect the Loop callback is actually called when the buffer has no more data to load, rather than it reaching the end.

  • :setFinishCallback() triggers the callback when a Fileplayer is manually :stop()'ed, not just when the end of a file is reached. This might be intentional, however, it also triggers the callback if you call :stop() before attaching the finish callback, which I would not expect if both these functions execute synchronously.

  • Weird edge case, but calling fp:play(0), fp:stop(), fp:play() plays the file on repeat, as if the original value for repeatCount is retained. Explicitly calling :play(1) has the intended effect.