Skip to content

Instantly share code, notes, and snippets.

@retorillo
Last active March 30, 2017 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save retorillo/9ff9c86779d1314a15069403c09ec231 to your computer and use it in GitHub Desktop.
Save retorillo/9ff9c86779d1314a15069403c09ec231 to your computer and use it in GitHub Desktop.

Playing short audio file on Firefox

The following problems seems to raise only on Firefox. (Chrome and Edge can play short audio file well)

This problems and solutions are confirmed on Firefox 52.0.2 (32-bit) on Windows 10 (x64)

Go to mute state

When audio file is too short (eg. 10ms), Firefox seems to go to mute state, and cannot listen it.

To solve this problem, play silence audio loop (>= 1sec) in background.

Audio quality

When playing short audio, its quality may be aweful. Should append silence(>= 5ms) after audio file.

Decoding Errors

Firefox may be failed to decode MP3 file if it is too short (< 50ms).

Media resource ***** could not be decoded.

To solve this problem:

  • Append silence until total length become 30ms - 50ms at least.
  • Use CBR instead of VBR (eg. Should not use lame -v)
  • Convert to WAV file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment