Open ddyer0 opened 3 years ago
Interesting. Do you get the same issue if you load the clip from FileSystemStorage rather than the resource file?
Yes, the source of the clip doesn't matter. In another variation, I made a binary in-memory file and read it using a ByteArrayInputStream; no difference.
I'm curious specifically about an input stream created from filesystemstorage. That will follow a different code path.
The version that I actually deploy (rather than the test program I provided) uses this:
final InputStream instream = data==null
? new FileInputStream(clipFile)
: new ByteArrayInputStream(data);
and arranges for the FileInputStream to be a copy of the resource file.
The attached test program plays a series of short sound clips, each clip plays 3 times, and should therefore be identical each time. They are not. Sometimes a clip plays correctly, sometimes not at all, sometimes in an audibly damaged way. This problem manifests differently on different hardware, and short clips seem to be particularly problematic. For comparison, you can build this for IOS.
The times reported while the clips are playing are elapsed time from start to when the doneplaying callback is executed. Its' suspicious that the play times are irregular and sometimes shorter than the sound clips actual duration.
theme.zip