How to use the nativescript-audio.TNSRecorder.CAN_RECORD function in nativescript-audio

To help you get started, we’ve selected a few nativescript-audio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nstudio / nativescript-audio / demo / app / main-view-model.ts View on Github external
public async startRecord(args) {
    try {
      if (!TNSRecorder.CAN_RECORD()) {
        dialogs.alert('This device cannot record audio.');
        return;
      }
      const audioFolder = knownFolders.currentApp().getFolder('audio');
      console.log(JSON.stringify(audioFolder));

      let androidFormat;
      let androidEncoder;
      if (platform.isAndroid) {
        // m4a
        // static constants are not available, using raw values here
        // androidFormat = android.media.MediaRecorder.OutputFormat.MPEG_4;
        androidFormat = 2;
        // androidEncoder = android.media.MediaRecorder.AudioEncoder.AAC;
        androidEncoder = 3;
      }

nativescript-audio

NativeScript plugin to record and play audio.

MIT
Latest version published 3 years ago

Package Health Score

52 / 100
Full package analysis