You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by douglasmoraisdev <gi...@git.apache.org> on 2017/07/19 14:31:46 UTC

[GitHub] cordova-plugin-camera pull request #282: Fix camera permissions bug on video...

GitHub user douglasmoraisdev opened a pull request:

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

    Fix camera permissions bug on video streaming

    Versions
    Ionic 3.5.0
    Cordova 7.0.1
    Cordova Camera Plugin 2.4.2-dev
    
    ### Platforms affected
    Android
    
    ### What does this PR do?
    This fix a bug found while developing a WebRTC app using Ionic on Android 7.0 and/or Android 4.4~ when using cordova.plugins.permissions to fix the new SDK 24 rules for access to camera device stream.
    Applies to the new changes for access rules for camera on Android > 7.0 (Sdk > 24).
    
    
    ### What testing has been done on this change?
    Without this fix, the camera does work on WebRTC Applications

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

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

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

    https://github.com/apache/cordova-plugin-camera/pull/282.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 #282
    
----
commit 8575f13e7a3e21ba1f5db32dbb0f23099b923c42
Author: Douglas Morais <ms...@gmail.com>
Date:   2017-07-19T14:18:37Z

    Fix camera permissions on video streaming
    
    Applies to the new changes for access rules for camera on Android > 7.0 (Sdk > 24)

commit ad7a8e77c4d32a3c2f92d736de9f97611719b84f
Author: Douglas Morais <ms...@gmail.com>
Date:   2017-07-19T14:28:55Z

    Merge pull request #1 from douglasmoraisdev/douglasmoraisdev-fixes-on-origin
    
    Fix camera permissions bug on video streaming

----


---
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


[GitHub] cordova-plugin-camera issue #282: Fix camera permissions bug on video stream...

Posted by douglasmoraisdev <gi...@git.apache.org>.
Github user douglasmoraisdev commented on the issue:

    https://github.com/apache/cordova-plugin-camera/pull/282
  
    
    > The code you link to (step 4 of the guide) doesn't use cordova-plugin-camera's JS API. It uses:
    
    @filmaj, yes, you're right. But this is a html5 web codage, if you apply this codelab to your cell phone, you will need to (or choose) to use the cordova-plugin-camera.
    
    For use...
    ```
    navigator.getUserMedia = navigator.getUserMedia ||
        navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
    ```
    ... on mobile, you need the plugin and permissions on camera.
    
    I found the same problem testing this project:
    https://github.com/eface2face/iOSRTCApp
    
    It's a diferent implementation than the Codelabs, and this uses the cordova-plugin-camera too. On a Android 7.0 device, i can't access the camera (black screen).
    
    This is just an example. I found the problem this way, but I see this affect the new Android 7.0 (SDK 24 and 25) and upcoming versions because of the new permissions-related changes. You can read more about this at:
    Https://developer.android.com/about/versions/nougat/android-7.0-changes.html#perm (changes on permissions section).


---
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


[GitHub] cordova-plugin-camera issue #282: Fix camera permissions bug on video stream...

Posted by filmaj <gi...@git.apache.org>.
Github user filmaj commented on the issue:

    https://github.com/apache/cordova-plugin-camera/pull/282
  
    The code you link to (step 4 of the guide) doesn't use cordova-plugin-camera's JS API. It uses:
    
    ```
    navigator.getUserMedia = navigator.getUserMedia ||
        navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
    ```
    
    So I don't see how this permission applies to the camera plugin specifically. Perhaps one requires the camera permission for that newer, more modern JS API, but if it's not related to the specific APIs provided by cordova-plugin-camera, I don't think this change belongs in this plugin.


---
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


[GitHub] cordova-plugin-camera issue #282: Fix camera permissions bug on video stream...

Posted by douglasmoraisdev <gi...@git.apache.org>.
Github user douglasmoraisdev commented on the issue:

    https://github.com/apache/cordova-plugin-camera/pull/282
  
    As I mentioned earlier, I am developing a WebRTC application based on Google WebRTC Codelabs. (https://codelabs.developers.google.com/codelabs/webrtc-web/).
    If you try to follow the step 4 of this Codelab on a Ionic (v1) project, I guess you can reproduce the error.
    
    I fixed the bug in my project by adding the PR code in plugins.xml OR by adding the same permissions in /platforms/android/AndroidManifest.xml manually (which is the same thing)
    
    If this help, this is my package.json on my Ionic (v1) project:
    '''
    {
        "name": "mobile",
        "version": "0.0.1",
        "description": "Real Time Comunicator",
        "devDependencies": {
            "@ionic/cli-plugin-cordova": "1.4.1",
            "@ionic/cli-plugin-gulp": "1.0.2",
            "@ionic/cli-plugin-ionic1": "2.0.1",
            "gulp": "^3.9.1",
            "gulp-clean-css": "^3.7.0",
            "gulp-rename": "^1.2.0",
            "gulp-sass": "^3.1.0"
        },
        "dependencies": {
            "@ionic-native/camera": "^4.0.1",
            "@ionic-native/diagnostic": "^4.0.1",
            "clean": "^4.0.2",
            "cordova-android": "^6.2.3",
            "cordova-browser": "^4.1.0",
            "cordova-plugin-android-permissions": "git+https://github.com/NeoLSN/cordova-plugin-android-permissions.git",
            "cordova-plugin-camera": "git+https://github.com/apache/cordova-plugin-camera.git",
            "cordova-plugin-compat": "^1.1.0",
            "cordova-plugin-console": "^1.0.7",
            "cordova-plugin-crosswalk-webview": "git+https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview.git",
            "cordova-plugin-device": "^1.1.6",
            "cordova-plugin-file": "^4.3.3",
            "cordova-plugin-media-capture": "git+https://github.com/apache/cordova-plugin-media-capture.git",
            "cordova-plugin-microphone": "git+https://github.com/amitgur/cordova-plugin-microphone.git",
            "cordova-plugin-splashscreen": "^4.0.3",
            "cordova-plugin-statusbar": "^2.2.3",
            "cordova-plugin-whitelist": "^1.3.2",
            "ionic-plugin-keyboard": "^2.2.1"
        },
        "cordova": {
            "plugins": {
                "cordova-plugin-console": {},
                "cordova-plugin-device": {},
                "cordova-plugin-splashscreen": {},
                "cordova-plugin-statusbar": {},
                "cordova-plugin-whitelist": {},
                "ionic-plugin-keyboard": {},
                "cordova-plugin-crosswalk-webview": {
                    "XWALK_VERSION": "23+",
                    "XWALK_LITEVERSION": "xwalk_core_library_canary:17+",
                    "XWALK_COMMANDLINE": "--disable-pull-to-refresh-effect",
                    "XWALK_MODE": "embedded",
                    "XWALK_MULTIPLEAPK": "true"
                },
                "cordova-plugin-camera": {},
                "cordova-plugin-media-capture": {},
                "cordova-plugin-android-permissions": {}
            },
            "platforms": [
                "android",
                "browser"
            ]
        }
    }
    '''
    
    If you still need more info, i will commit a simple code and tell you when to do it.


---
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


[GitHub] cordova-plugin-camera issue #282: Fix camera permissions bug on video stream...

Posted by filmaj <gi...@git.apache.org>.
Github user filmaj commented on the issue:

    https://github.com/apache/cordova-plugin-camera/pull/282
  
    @douglasmoraisdev how can I test that this change is needed? Is there a particular camera API i need to access on API 24+ to see the failure? Just want to reproduce the failed / fixed scenarios. Thanks for any info.


---
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


[GitHub] cordova-plugin-camera issue #282: Fix camera permissions bug on video stream...

Posted by zds-jack <gi...@git.apache.org>.
Github user zds-jack commented on the issue:

    https://github.com/apache/cordova-plugin-camera/pull/282
  
    android 6.0.1  
    cordova-plugin-camera   2.4.1  
    I have two questions:
    1.   
    ![20170905112741](https://user-images.githubusercontent.com/16936239/30043969-551974b0-922d-11e7-8649-03414d0940f6.jpg)
    Turn on the camera and take a picture later. Will cause the application to crash
    Can only be used DestinationType.FILE_URI
    2.
    allowEdit:true  CAMERA can use,
    but   CAMERA. PHOTOLIBRARY  invalid



---

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