Limitations of Video Capture in Phone Gap + Native Plugins

前端 未结 1 1505
栀梦
栀梦 2021-02-19 11:37

I am developing a mobile app targeting the iOS and Android platforms. The app will consist of:

  1. A relatively simple \'user login/signup and listing of database

相关标签:
1条回答
  • 2021-02-19 11:49

    I have essentially gotten to the bottom of this question, that I am sure others are and will face. I will address the topic in 3 parts:

    Can I do [something] in PhoneGap (as opposed to in native iOS or Android SDK)?

    This is a question I'd imagine many developers considering the PhoneGap framework find themselves asking, as did I. The short answer is YES, YOU PROBABLY CAN.

    How do I do [something] in PhoneGap?

    Plugins! Here's the rub: Cordova (PhoneGap) in all it's brilliance is extremely limited in the way it accesses native hardware features, especially when you get into video/photo/audio capture.

    This is where plugins come in. There are thousands of PhoneGap plugins at this point. Many are as simple as 4 lines of Java and Objective C to get over some simple thing that PhoneGap just won't do. Others are large projects with lifecycles of their own.

    In my case, it became very clear very early on that I was not going to be able to build my app with the video capture functions that existed in PhoneGap. That said, I went shopping for plugins. By the end of my project it had taken 2 plugins that extended video functionality and four more to do other small various things I needed. In a few cases, the plugins I found did not have everything I needed, and I wound up contributing bits of code. If the projects are active on GitHub, I highly recommend this.

    In the end, there were things I wanted to do that I could not find plugins for. I still have plans to build some of my own, but am not there yet. Bottom line: Outside of gaming and other 3d rendering applications, you'll be hard pressed to find something that can't be achieved with a PhoneGap plugin.

    For those interested specifically in video capture, these are the 2 plugins that got me over the hump in my project:

    VideoCapturePlus

    Video Screenshot

    Should I build my app that does [something] in PhoneGap?

    Of course, this question is up to each developer, and what the goals of the app are. In my case, a simple app that among other things captures and uploads photos and short videos was quite possible. There are certainly cases in which the parameters and goals of the app make it such that native development is the best option.

    That said, for most solo devs or small teams with limited resources and little or no Java or ObjC experience, the answer to the question, "Should I consider PhoneGap?", would be [in my best Jim Halpert voice], "Absolutely you should". As an added bonus, I will say this: In my case, the HTML5 layouts, and much of the front end JS that were used for both the Android and iOS versions of my app are largely reusable for the mobile web version of my app. Being able to maintain a single codebase for those three things offers efficiency that even larger resourced organizations shouldn't overlook.

    0 讨论(0)
提交回复
热议问题