微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – Cordova插件摄像头Mediatype与视频无法正常工作

我正在研究带角度的Cordova离子应用程序.我正在使用this plugin的相机功能.我正在尝试将相机设置为图片和视频,但问题是:我只能拍照.摄像机无法正常工作.我试过2台三星设备(平板电脑和手机).

这是我的代码:(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">

我需要帮助:相机应该记录照片和视频.它现在只拍照片.
PICTURE: The Videocamera Button is not clickable

解决方法:

我还没看过这个应用程序的代码(它是一个Ionic 2应用程序,它只记录视频),但是你可以看看那里使用的插件以及它们是如何工作的(在nexus 7 2013上工作).

https://github.com/rossmartin/video-editor-ionic2

这些是必需的插件

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐