UNPKG

ng-cordova

Version:

[ngCordova](http://ngcordova.com/) ==========

98 lines (76 loc) 2.42 kB
// install : cordova plugin add https://github.com/EddyVerbruggen/VideoCapturePlus-PhoneGap-Plugin.git // link : https://github.com/EddyVerbruggen/VideoCapturePlus-PhoneGap-Plugin angular.module('ngCordova.plugins.videoCapturePlus', []) .provider('$cordovaVideoCapturePlus', [function () { var defaultOptions = {}; /** * the nr of videos to record, default 1 (on iOS always 1) * * @param limit */ this.setLimit = function setLimit(limit) { defaultOptions.limit = limit; }; /** * max duration in seconds, default 0, which is 'forever' * * @param seconds */ this.setMaxDuration = function setMaxDuration(seconds) { defaultOptions.duration = seconds; }; /** * set to true to override the default low quality setting * * @param {Boolean} highquality */ this.setHighQuality = function setHighQuality(highquality) { defaultOptions.highquality = highquality; }; /** * you'll want to sniff the user-Agent/device and pass the best overlay based on that.. * set to true to override the default backfacing camera setting. iOS: works fine, Android: YMMV (#18) * * @param {Boolean} frontcamera */ this.useFrontCamera = function useFrontCamera(frontcamera) { defaultOptions.frontcamera = frontcamera; }; /** * put the png in your www folder * * @param {String} imageUrl */ this.setPortraitOverlay = function setPortraitOverlay(imageUrl) { defaultOptions.portraitOverlay = imageUrl; }; /** * * @param {String} imageUrl */ this.setLandscapeOverlay = function setLandscapeOverlay(imageUrl) { defaultOptions.landscapeOverlay = imageUrl; }; /** * iOS only * * @param text */ this.setOverlayText = function setOverlayText(text) { defaultOptions.overlayText = text; }; this.$get = ['$q', '$window', function ($q, $window) { return { captureVideo: function (options) { var q = $q.defer(); if (!$window.plugins.videocaptureplus) { q.resolve(null); return q.promise; } $window.plugins.videocaptureplus.captureVideo(q.resolve, q.reject, angular.extend({}, defaultOptions, options)); return q.promise; } }; }]; }]);