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

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

  • @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.

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

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

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

  • @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 :

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

    @jittopjose : You can have a look to this project :

    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.

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

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

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

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

Log in to reply