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

    Is it possible to make laptop camera available to app running in "clickable desktop"

    Scheduled Pinned Locked Moved Solved App Development
    8 Posts 3 Posters 620 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.
      • rineezR Offline
        rineez
        last edited by

        I made an HTML+JS app that tries to access device camera. I'm trying to test this app using "clickable desktop" command. But it seems the clickable's container environment is not able to detect my laptop camera/mic etc when I query for media devices using javascript navigator.mediaDevices.getUserMedia(). Is it possible to test camera access in clickable desktop environment?

        Thanks,
        Rineez

        arubislanderA 1 Reply Last reply Reply Quote 0
        • rineezR Offline
          rineez @arubislander
          last edited by rineez

          @arubislander From my reading of the documentations I couldn't figure out any formal way to configure the Multimedia support in "docker run" command but I did something hackish and got camera working in clickable desktop. Audio devices were already accessible in the docker.
          Under by Home directory I found the place where the clickable python scripts are installed.
          In there I searched further and found the script "commands/docker/multimedia_support.py"
          Here I found the audio device(dev/snd) was already being made accessible to the docker container through the config hard coded here.
          So I edited the code in this file, to pass my camera devices also in the key-value list passed into docker_config.volumes.update method.
          Then I re-run my app and Voila! camera access started working in my app.
          From clickable.log I could see the key-value pairs passed in here are coming out in the docker run command executed while launching app as volumes to be mounted(-v arguments).
          Thanks for your support.

          Thanks,
          Rineez

          arubislanderA 1 Reply Last reply Reply Quote 2
          • arubislanderA Offline
            arubislander @rineez
            last edited by

            @rineez Unfortunately this is not yet possible. Clickable desktop runs your app in a docker container. To achieve what you are looking for work would need to be done in configuring the container to make the camera available from the container as a first step. If after that things would 'just work', would still remain to be seen.

            πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
            Happily running Ubuntu Touch
            Google Pixel 3a (20.04 DEV)
            JingPad (24.04 preview)
            Meizu Pro 5 (16.04 DEV)

            rineezR 1 Reply Last reply Reply Quote 1
            • rineezR Offline
              rineez @arubislander
              last edited by

              @arubislander Thanks for the direction. Is there some way to customize the docker run command used by clickable to start the underlying container?
              I have seen some other docker related post that suggest --device= parameter can be passed to "docker run" command to map a device of the host into the container.
              For example, this SO thread https://stackoverflow.com/questions/34302096/sharing-devices-webcam-usb-drives-etc-with-docker

              Thanks,
              Rineez

              arubislanderA 1 Reply Last reply Reply Quote 0
              • arubislanderA Offline
                arubislander @rineez
                last edited by

                @rineez I didn't come across any such option. But check the clickable documentation, maybe I missed something.

                πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
                Happily running Ubuntu Touch
                Google Pixel 3a (20.04 DEV)
                JingPad (24.04 preview)
                Meizu Pro 5 (16.04 DEV)

                rineezR 1 Reply Last reply Reply Quote 1
                • rineezR Offline
                  rineez @arubislander
                  last edited by rineez

                  @arubislander From my reading of the documentations I couldn't figure out any formal way to configure the Multimedia support in "docker run" command but I did something hackish and got camera working in clickable desktop. Audio devices were already accessible in the docker.
                  Under by Home directory I found the place where the clickable python scripts are installed.
                  In there I searched further and found the script "commands/docker/multimedia_support.py"
                  Here I found the audio device(dev/snd) was already being made accessible to the docker container through the config hard coded here.
                  So I edited the code in this file, to pass my camera devices also in the key-value list passed into docker_config.volumes.update method.
                  Then I re-run my app and Voila! camera access started working in my app.
                  From clickable.log I could see the key-value pairs passed in here are coming out in the docker run command executed while launching app as volumes to be mounted(-v arguments).
                  Thanks for your support.

                  Thanks,
                  Rineez

                  arubislanderA 1 Reply Last reply Reply Quote 2
                  • arubislanderA Offline
                    arubislander @rineez
                    last edited by arubislander

                    @rineez That is great news. Well done!

                    Please consider submitting your changes as a PR to the Clickable repository if they are not specific to your development environment setup

                    πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
                    Happily running Ubuntu Touch
                    Google Pixel 3a (20.04 DEV)
                    JingPad (24.04 preview)
                    Meizu Pro 5 (16.04 DEV)

                    rineezR 1 Reply Last reply Reply Quote 3
                    • arubislanderA arubislander has marked this topic as solved on
                    • rineezR Offline
                      rineez @arubislander
                      last edited by

                      @arubislander I'm not sure. I suspect the name of video device can change for different environments. Some environments may not even have a camera, and I haven't yet tested for negative side effects of putting a non-existing device there.
                      I'm thinking I may have to write some additional code to detect camera devices in the environment to make it into a PR suitable for all users. I'll try to figure out though.

                      Thanks for the encouragement

                      Thanks,
                      Rineez

                      1 Reply Last reply Reply Quote 2
                      • L Offline
                        L-00818
                        last edited by

                        This post is deleted!
                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post