Implemented a conditional check to allow for the duration to be provided on the Android platform for SDK 8 and above.

This commit is contained in:
Richard Burton 2013-03-14 12:15:02 -07:00 committed by Braden Shepherdson
parent 66b827e502
commit 9fa6cea69b

View File

@ -23,6 +23,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import android.os.Build;
import org.apache.cordova.api.CallbackContext;
import org.apache.cordova.api.CordovaPlugin;
import org.apache.cordova.api.LOG;
@ -216,9 +217,10 @@ public class Capture extends CordovaPlugin {
*/
private void captureVideo(double duration) {
Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
// Introduced in API 8
//intent.putExtra(android.provider.MediaStore.EXTRA_DURATION_LIMIT, duration);
if(Build.VERSION.SDK_INT > 8){
intent.putExtra(android.provider.MediaStore.EXTRA_DURATION_LIMIT, duration);
}
this.cordova.startActivityForResult((CordovaPlugin) this, intent, CAPTURE_VIDEO);
}