cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From TanaseButcaru <...@git.apache.org>
Subject [GitHub] cordova-plugin-camera pull request: Add getVideo() feature with th...
Date Sat, 16 Jan 2016 11:52:21 GMT
GitHub user TanaseButcaru opened a pull request:

    https://github.com/apache/cordova-plugin-camera/pull/152

    Add getVideo() feature with thumbnail creation

    I've implemented the `getVideo` function for cordova-plugin-camera which gives the user
the ability to record a video with default camera app.
    
    You can create a sample cordova app and copy the www files from `samples/android/www_getVideo`
and run an interactive test of this feature with all the options, as follows:
     *          `quality`: points to `Camera.VideoQuality`,
     *          `sourceType`: points to `Camera.VideoSourceType`,
     *          `encodingType`: points to `Camera.VideoEncodingType`,
     *          `mediaType`: points to `Camera.MediaType`,
     *          `mediaThumbnail`: points to `Camera.MediaThumbnail`,
     *          `mediaDurationLimit`: numeric value, 0 = disabled
     *          `mediaSizeLimit`: numeric value, 0 = disabled  
    
    ... where:
    ```js
    VideoEncodingType:{
        /** Return 3GP encoded video */
        GPP: 2,
        /** Return MP4 encoded video */
        MP4: 3,
        /** Return WEBM encoded video */
        WEBM: 4,
        /** Return MKV encoded video */
        MKV: 5
      },
    
    MediaThumbnail:{
        /** Media thumbnail disabled */
        NONE: 0,
        /** Creates a thumbnail of 512x384 px */
        MINI_KIND: 1,
        /** Creates a thumbnail of 96x96 px */
        MICRO_KIND: 2
     },
    
    VideoSourceType:{
        /** Choose video from video library */
        VIDEOLIBRARY : 0,
        /** Take video from camera */
        CAMERA : 1
      },
    
    VideoQuality:{
        /**  Low quality, suitable for MMS messages */
        LOW : 0,
        /** High quality */
        HIGH: 1
      },
    ```
    I always thought that this plugin would launch the camera app in recording mode if `sourceType`
set to CAMERA and `mediaType` set to VIDEO, but when I needed this I found that it's not implemented,
so I made it myself.
    
    I'm just a web dev, not a software developer, but I managed to get it done; this is my
first contribution to a cordova plugin with native code, so there might be things that are
not written well or missing checks. I'm open to suggestions and contributions for this.
    Android only for the moment. If there's someone that can port this to iOS would be much
appreciated, but in the meantime, I'll try my luck with that too.
    
    Tested with two real devices: Sony Xperia Z3 Compact (5.1.1) and Sony Xperia Sola (unofficial
4.4.4)
    Here are two screenshots with the interactive sample:
    
    ![1](https://cloud.githubusercontent.com/assets/5818117/12372196/2ac9ecb4-bc58-11e5-96d9-d24221da5a2c.png)
    ![2](https://cloud.githubusercontent.com/assets/5818117/12372197/2ad31c30-bc58-11e5-9917-2906ec6ab660.png)


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/TanaseButcaru/cordova-plugin-camera master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-camera/pull/152.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #152
    
----
commit 6fcf212ceeb89c049c046aa937c735fe62cff50b
Author: TanaseButcaru <contact@butcaru.com>
Date:   2016-01-14T22:22:11Z

    getVideo() support

commit 6fd443eca382204bdda70683dbc49c9db6f2b7c1
Author: TanaseButcaru <contact@butcaru.com>
Date:   2016-01-15T21:41:14Z

    getVideo() update + mediaThumbnail

commit 5e347284d70a7e25a16a91350508e8da2e103ec6
Author: TanaseButcaru <contact@butcaru.com>
Date:   2016-01-15T21:49:36Z

    getVideo() fix module already defined error

commit 6c6bfae57239f123b7bfffabcdffae1c15993d81
Author: TanaseButcaru <contact@butcaru.com>
Date:   2016-01-16T11:17:53Z

    getVideo(), createMediaThumbnail, descriptions, full sample

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message