I am trying to record multiple videos using phoneGap/Apache Cordova plugin but after every recording it prompts to save or discard. How do I get rid of this option and autosave every video recording ? (I used duration options as 15 sec which it stops recording after 15 sec and then prompts to save or discard)
// capture callback
var captureSuccess = function(mediaFiles) {
var i, path, len;
for (i = 0, len = mediaFiles.length; i < len; i += 1) {
path = mediaFiles[i].fullPath;
// do something interesting with the file
}
};
// capture error callback
var captureError = function(error) {
navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error');
};
// start video capture
navigator.device.capture.captureVideo(captureSuccess, captureError, {limit:2, duration:15});
From the Cordova plugin, it is not possible to change that behavior.
What the Cordova capture.captureVideo() JS method is doing is simply firing an intent with android.provider.MediaStore.ACTION_VIDEO_CAPTURE and then getting the file of saved video. The actual recording and save/discard (ie, confirm/cancel) is handled by Android itself, not by the Cordova plugin.
https://github.com/apache/cordova-plugin-media-capture/blob/master/src/android/Capture.java#L250
A quick look at the MediaStore API does not find any options to auto-save a capture.
http://developer.android.com/reference/android/provider/MediaStore.html
Assuming that the video capture is user-triggered, my personal opinion is that it is good practice to let the user re-capture or discard the video if they don't like it, instead of automatically committing their capture.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.