问题
I am trying to lock camera orientation to portrait in the app and to landscape in the camera.
For camera access I am using $cordovaCapture pluggin. For orientation cordova-plugin-screen-orientation.
Both plugins work but orientation plugin doesn't affect camera. (Testing in an Android)
screen.lockOrientation('portrait');
$scope.captureVideo = function() {
var options = {
limit: 1,
duration: 15
};
screen.lockOrientation('landscape');
$cordovaCapture.captureVideo(options)
.then(function(videoData) {
screen.lockOrientation('portrait');
//Whatever
});
};
With that code, app orientation is locked to portrait, when captureVideo() is call for some ms you can feel that is locked to landscape, then camera is opened and you can record video both landscape and portrait. Then, again in the app, orientation is lock again to portrait.
Capture plugin doesn't have more options so I think maybe is not possible right now with Ionic. Am I right? Any idea how to get what I want?
回答1:
It's a bug! I think someone should change the plugin to add the property of the interface.
var options = {
limit: 1,
duration: 15,
orientation: "landscapeLeft"
};
来源:https://stackoverflow.com/questions/31558337/lock-camera-screen-orientation-to-landscape-with-ionic-ngcordova