cordova-plugin-media (7.0.0) plays and records audio through Android's native MediaPlayer and MediaRecorder classes. cordova-plugin-media-capture (6.0.0) asks another app to record audio, video or a photo and returns the file. With a three-second chime in www/audio:
const chime = new Media('/android_asset/www/audio/chime.wav',
() => console.log('finished'), (err) => console.log('media error', err.code));
chime.play();
await new Promise((resolve) => setTimeout(resolve, 1000));
const position = await new Promise((resolve, reject) =>
chime.getCurrentPosition(resolve, reject));
const capture = await new Promise((resolve) =>
navigator.device.capture.captureAudio(resolve, resolve, { limit: 1 }));
({ duration: chime.getDuration(), position, capture: capture.code });{ duration: 3, position: 0.764, capture: 20 }Playback worked: after one second the position was 0.764 s, the rest being start-up time. Capture failed with code 20, CAPTURE_NOT_SUPPORTED, and the message No Activity found to handle Audio Capture., because this Android image has no sound-recorder app to answer the intent, and you cannot assume every phone has one. For an app that must record, use Media's startRecord(), which records in-process, rather than depending on another app. For simple playback, an HTML <audio> element needs no plugin at all.