gpt4 book ai didi

cordova - 如何使用cordova/ionic应用程序强制相机处于纵向模式?

转载 作者:行者123 更新时间:2023-12-01 04:58:31 31 4
gpt4 key购买 nike

我正在开发混合应用程序,我正在从我的应用程序调用相机,我希望此相机仅处于纵向模式。我尝试通过将配置文件更改为:

<preference name="orientation" value="portrait"/>
但是当相机打开时它开始旋转。我该如何预防?

最佳答案

存在一个插件来强制定向

https://github.com/gbenvenuti/cordova-plugin-screen-orientation

只需在进入相机模式前强制肖像,退出后禁用它。

// set to either landscape
screen.lockOrientation('landscape');

// allow user rotate
screen.unlockOrientation();

我不知道这是否可行,因为相机是原生的,但是如果您将相机嵌入到您的应用程序中,则肯定可以使用。

请发布您的结果;)

关于cordova - 如何使用cordova/ionic应用程序强制相机处于纵向模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35036833/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com