【问题标题】:Lock camera / screen orientation to landscape with Ionic / ngCordova使用 Ionic / ngCordova 将相机/屏幕方向锁定为横向
【发布时间】:2015-10-12 01:05:27
【问题描述】:

我正在尝试将相机方向锁定为应用程序中的纵向和相机中的横向。

对于相机访问,我使用$cordovaCapture 插件。 定向cordova-plugin-screen-orientation.

两个插件都可以工作,但方向插件不影响相机。 (在 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
        });
};

使用该代码,应用程序方向被锁定为纵向,当 captureVideo() 被调用一些毫秒时,您会感觉到被锁定为横向,然后打开相机,您可以录制横向和纵向的视频。然后,再次在应用程序中,方向再次锁定为纵向。

Capture 插件没有更多选项,所以我认为现在使用 Ionic 可能是不可能的。我对吗?知道如何得到我想要的吗?

【问题讨论】:

  • 我不认为它在 android 上是可能的,因为它会向相机启动一个 Intent,你会失去对应用程序的控制
  • Mikel @jcesarmobile 是对的,你不能在 Android 中这样做

标签: cordova html5-video ionic-framework android-camera screen-orientation


【解决方案1】:

这是一个错误!我认为应该有人更改插件以添加接口的属性。

var options = { 
    limit: 1, 
    duration: 15,
    orientation: "landscapeLeft"
};

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-29
    • 1970-01-01
    相关资源
    最近更新 更多