How to use the cordova-plugin-media-capture.CaptureError function in cordova-plugin-media-capture

To help you get started, we’ve selected a few cordova-plugin-media-capture 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 apache / cordova-plugin-media-capture / src / browser / CaptureProxy.js View on Github external
}, function (/* err */) {
        errorCB(new CaptureError(CaptureError.CAPTURE_INTERNAL_ERR));
    });
};
github apache / cordova-plugin-media-capture / src / windows / CaptureProxy.js View on Github external
captureAudio: function (successCallback, errorCallback, args) {
        var options = args[0];

        var audioOptions = new CaptureAudioOptions();
        if (typeof (options.duration) === 'undefined') {
            audioOptions.duration = 3600; // Arbitrary amount, need to change later
        } else if (options.duration > 0) {
            audioOptions.duration = options.duration;
        } else {
            errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
            return;
        }

        // Some shortcuts for long namespaces
        var CaptureNS = Windows.Media.Capture;
        var MediaPropsNS = Windows.Media.MediaProperties;
        var localAppData = Windows.Storage.ApplicationData.current.localFolder;
        var generateUniqueName = Windows.Storage.NameCollisionOption.generateUniqueName;

        var mediaCapture = new CaptureNS.MediaCapture();
        var mediaCaptureSettings = new CaptureNS.MediaCaptureInitializationSettings();
        var mp3EncodingProfile = new MediaPropsNS.MediaEncodingProfile.createMp3(MediaPropsNS.AudioEncodingQuality.auto); // eslint-disable-line new-cap
        var m4aEncodingProfile = new MediaPropsNS.MediaEncodingProfile.createM4a(MediaPropsNS.AudioEncodingQuality.auto); // eslint-disable-line new-cap

        mediaCaptureSettings.streamingCaptureMode = CaptureNS.StreamingCaptureMode.audio;
github apache / cordova-plugin-media-capture / src / windows / CaptureProxy.js View on Github external
}, function () {
                                // if we here, we're totally failed to record either mp3 or m4a
                                errorCallback(new CaptureError(CaptureError.CAPTURE_INTERNAL_ERR));

                            });
                        });
github apache / cordova-plugin-media-capture / src / windows / CaptureProxy.js View on Github external
function fail (code, data) {
            var err = new CaptureError(code);
            err.message = data;
            errorCallback(err);
        }
github apache / cordova-plugin-media-capture / src / windows / MediaFile.js View on Github external
}, function () {
                            errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
                        }
                    );