# `MobMedia.SelfTest`
[🔗](https://github.com/GenericJam/mob_media/blob/0.1.0/lib/mob_media/self_test.ex#L1)

The plugin's on-device proof (`Mob.Plugin.SelfTest`), run by
`mix mob.selftest` and mob_ci for every activated plugin.

It writes a one-second 44.1 kHz stereo WAV of a 440 Hz tone, then through
the NIF (`MobMedia.Engine.Native`):

  1. `MobMedia.info/2` must report audio, no video, and a duration within
     50 ms of 1000;
  2. `MobMedia.audio_pcm/2` must decode it to 16 kHz mono: 32 000 bytes
     (within 50 ms) of audible signal. On Android that's `MediaExtractor`,
     a `MediaCodec` raw decoder and the bridge's downmix and resampler; on
     iOS `AVAssetReader` with LinearPCM output settings;
  3. `MobMedia.frame/3` on it must answer `{:error, :no_video}`, which takes
     a real look at the file's tracks.

The WAV is deleted afterwards. There is no skip: no hardware, permission or
network is involved, so every device and simulator gives the full answer.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
