UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Camera App (made with html, css, java) not having acces to camera.

    Scheduled Pinned Locked Moved App Development
    15 Posts 6 Posters 1.2k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • C Offline
        ComLarsic
        last edited by

        I am making a simple camera app based on the work over here: https://github.com/kasperkamperman/MobileCameraTemplate

        When i build it using clickable it will not detect the camera, is there way to give it access to the camera?

        AppLeeA 1 Reply Last reply Reply Quote 0
        • AppLeeA Offline
          AppLee @ComLarsic
          last edited by

          @ComLarsic
          Basic check to start :

          • Do you have the right set in apparmor file ?
          • Be sure to use your latest click by :
            • Try increasing the version number before pushing your app to your test device
            • And alternative is to delete the app on the phone then install it again
          C 1 Reply Last reply Reply Quote 0
          • C Offline
            ComLarsic @AppLee
            last edited by

            @AppLee

            1. Yes i do
            2. i am using the latest click
            AppLeeA 1 Reply Last reply Reply Quote 0
            • AppLeeA Offline
              AppLee @ComLarsic
              last edited by

              @ComLarsic Hum what exactly is your behaviour ?

              I had a quick look at the github repository and maybe it has something to do with Morph Browser.
              I don't think Morph can access the camera, it's not working with websites like jitsi.org...

              C 1 Reply Last reply Reply Quote 0
              • poVoqP Offline
                poVoq
                last edited by

                I think the underlaying qtwebengine should be able to do it, even in the relatively old version currently used in UT.

                Maybe just a question of triggering the permission request correctly?

                Fairphone 5 (waiting for port)

                1 Reply Last reply Reply Quote 0
                • H Offline
                  hummlbach
                  last edited by

                  Just in case... common pitfall: version number has to be bumped after apparmor file has been changed in order to become effective.

                  C 1 Reply Last reply Reply Quote 0
                  • J Offline
                    jittopjose
                    last edited by

                    @ComLarsic I would like to know how did you build the clickable app. Is it done like, clickable create and select html option. Then copy all your html and javascript code to www folder to build ?

                    I am also doing some experiments with a react app to build as click by packaging all the js and html file. Just like an offline html app.

                    C 1 Reply Last reply Reply Quote 0
                    • C Offline
                      ComLarsic @jittopjose
                      last edited by

                      @jittopjose yep, exactely like that. just make sure the .desktop file points to the correct .html/.htm file

                      1 Reply Last reply Reply Quote 0
                      • C Offline
                        ComLarsic @hummlbach
                        last edited by

                        @hummlbach ah, did not know that :/. i'll try that when i have the time

                        1 Reply Last reply Reply Quote 0
                        • C Offline
                          ComLarsic @AppLee
                          last edited by

                          @AppLee i open the app, and an javasvript alert pops up that there is no camera available.

                          when i look at the webrct log it sgates that there is no webcam available

                          AppLeeA 1 Reply Last reply Reply Quote 0
                          • AppLeeA Offline
                            AppLee @ComLarsic
                            last edited by

                            @ComLarsic
                            Yep that is how the app try to reach the camera, there are two things that I can think of right now.
                            First one is to adapt the code to qtWebengine because it seems to be browser oriented, basically that means rewriting the app because its core has to be adapted.
                            Another option I see is that the way UT protects access to the devices prevent from accessing it this way.

                            If I had to guess I'll opt for the second option and it could lead to "impossible with webapp" or to "you have to dive into the system to allow the device".

                            Depending on your coding ability I'll suggest to create a QML/C++ app using the provided API to access the camera :
                            https://api-docs.ubports.com/sdk/apps/qml/QtMultimedia/Camera.html

                            I don't have webdev skills too many abstraction layers for me brain to handle 😉

                            @jittopjose : You can have a look to this project :
                            https://gitlab.com/AppsLee/cardwallet

                            I just revived the project by creating a project with clickable. And I put the code from the original app into the www/ folder.
                            The code is simple enough for a template project so I hope it can help you.
                            And don't forget the apparmor and to bump the version number so it's well considered when testing.

                            C 1 Reply Last reply Reply Quote 0
                            • C Offline
                              ComLarsic @AppLee
                              last edited by

                              @AppLee alright, thanks for the advise!
                              since i dont know C++ i will look into pyotherside for QML/Python.

                              1 Reply Last reply Reply Quote 0
                              • poVoqP Offline
                                poVoq
                                last edited by

                                There is a somewhat outdated Cordova implementation for UT. I guess that could also be a good place for investigating if there is a way to access the camera from an HTML app.

                                I would be surprised if that is not possible somehow, as back in the day Canonical was promoting webapps with UT quite hard.

                                Fairphone 5 (waiting for port)

                                AppLeeA 1 Reply Last reply Reply Quote 0
                                • AppLeeA Offline
                                  AppLee @poVoq
                                  last edited by

                                  @poVoq Back in the day they didn't have Morph Browser and lots of things have changed.

                                  But you're right it's worth investigating. Good luck

                                  1 Reply Last reply Reply Quote 0
                                  • dobeyD Offline
                                    dobey
                                    last edited by

                                    It is currently not possible to use camera from browser, because QtWebEngine isn't using QtMultimedia for camera yet.

                                    1 Reply Last reply Reply Quote 1
                                    • First post
                                      Last post