- Install the plugin with this command -
phonegap.cmd plugin add ..\com.phonegap.newmedia
- Copy the MediaRecorderRecipe.java to the directory of your main activity java file.
- From the layout folder, copy the xml file to the layout folder of your phonegap project
[project_name]\platforms\android\res\layout\
- From the drawable folder, copy the files to the drawable folder of your phonegap project
[project_name]platforms\android\res\drawable\
- Use the javascript to start the camera activity view
- Use the result of the activity(result is the filename) to do what ever you like.
// start the camera activity
NewMedia.startRecord(captureSuccess, captureError, {
"bitrate": 700000,
"width": 480,
"height": 360,
});
// capture success callback
function captureSuccess(data) {
if (data.fullpath !== '') {
}
}
// capture error callback
function captureError(error) {
console.log("camera failed ", error);
}