Reputation: 103
i am working on a Cordova ionic App with angularjs. I am using this plugin for the camera function. I am trying to set the camera for pictures and videos but the problem is: i can only take picture. The Videocamera is not working. I tried it on 2 Samsung devices (Tablet and Phone).
This is my Code: (AngularJS)
var app = angular.module("app", ["ionic"]);
var controllerApp = function ($scope) {
$scope.message = "Its Works !";
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
console.log(navigator.camera);
}
$scope.getPic = function () {
navigator.camera.getPicture(onSuccess, onFail, {
quality: 25,
mediaType: Camera.MediaType.ALLMEDIA,
destinationType: Camera.DestinationType.DATA_URL,
});
function onSuccess(imageData) {
$scope.imgURI = "data:image/jpeg;base64," + imageData;
}
function onFail(message) {
alert('Failed because: ' + message);
}
}
};
app.controller("controllerApp", ["$scope", controllerApp]);
HTML
<div class="col col-40" ng-model="excercise.excerciseMedia">Set Media</div>
<button class="button button-dark col col-30 ion-camera" ng-click="getPic()">Camera</button>
<img ng-show="imgURI !== undefined" ng-src="{{imgURI}}" style="text-align: center">
I need help for: Camera should record photos and videos. It's taking right now only photos. PICTURE: The Videocamera Button is not clickable
Upvotes: 4
Views: 2728
Reputation: 44659
I didn't take a look at the code of this app yet (it's an Ionic 2 App and it only records videos) but you can take a look at the plugins used there and how they work (working on nexus 7 2013).
https://github.com/rossmartin/video-editor-ionic2
These are the required plugins:
cordova-plugin-camera
cordova-plugin-device
cordova-plugin-media-capture
https://github.com/driftyco/ionic-plugin-keyboard.git
cordova-plugin-statusbar
cordova-plugin-spinner-dialog
cordova-plugin-instagram-assets-picker
cordova-plugin-video-editor
Upvotes: 2