B4A Library Camera2 - New camera library

Discussion in 'Additional libraries, classes and official updates' started by Erel, Sep 12, 2017.

  1. Erel

    Erel Administrator Staff Member Licensed User

    Camera2 library is based on the newer Camera API introduced in Android 5 (API 21). It is therefore supported by Android 5+ devices.
    It requires B4A v7.3+.

    The library is built to work together with CamEx2 class.
    Camera2 native API is more complex than the old API. However together CamEx2 and the resumable subs feature it is quite simple to use.

    [​IMG]

    See the tutorial for more information: https://www.b4x.com/android/forum/threads/camera2-still-images-and-videos.83920/

    V1.10 is released. You need to update both CamEx2 (available in the tutorial) and the library.
    Most of the methods now expect a task index parameter. See the tutorial for more information.
     

    Attached Files:

    Last edited: Sep 14, 2017
  2. BillMeyer

    BillMeyer Active Member Licensed User

    Thank you - I must say - that desk looks amazingly like mine.
     
    victormedranop and Erel like this.
  3. NJDude

    NJDude Expert Licensed User

    I have to ask, will this new lib break any existing apps using the previous Camera lib version?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    No. This is a different library named Camera2.
     
  5. Toley

    Toley Active Member Licensed User

    Will it eventually replace the actual Camera Lib and be include in future B4A release?
     
  6. JordiCP

    JordiCP Well-Known Member Licensed User

    I guess they will co-exist, at least for a very long time (until there are no devices prior to Lollipop on Earth)
    The drama will come when Android definitely drops the legacy camera APi (right now, though deprecated, it is still present in Android N, and not sure if Android O): when this happens, a lot of apps using the legacy camera API will stop working for those devices :eek:
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    There are two questions here:
    1. No. It will never replace the Camera library. You will be able to choose whichever one you want.
    2. It will probably be included in the IDE starting from the next version.
     
    Toley likes this.
  8. Erel

    Erel Administrator Staff Member Licensed User

  9. Croïd

    Croïd Active Member Licensed User

    btnAutoExposure (sample) does not work for me ( android 7.1) ! do you have the problem?

    I use Camex1.11
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    What happens when you click on it?
     
  11. Croïd

    Croïd Active Member Licensed User

    Flash does not start !

    Code:
    *** Service (starter) Create ***
    ** 
    Service (starter) Start **
    ** 
    Activity (main) Create, isFirst = true **
    ** 
    Activity (main) Resume **
    Start success: 
    true
    ON_AUTO_FLASH
    ON_ALWAYS_FLASH
    OFF
    ON
    Picture taken: (
    Bitmap): 1080 x 1920, scale = 1,00
     
  12. Erel

    Erel Administrator Staff Member Licensed User

  13. Croïd

    Croïd Active Member Licensed User

    Thank Erel now the flash fires :)

    But the temporary image does not take into consideration light ! as a synchronization shift between the light and cam.DataToBitmap(Data)
     
Loading...