artoolkitx / jsartoolkit5

Javascript ARToolKit v5.x
https://artoolkitx.github.io/jsartoolkit5/examples/
Other
291 stars 69 forks source link

How to change the default camera ? #25

Closed ThorstenBux closed 6 years ago

ThorstenBux commented 6 years ago

Issue by iceleaf97 Saturday Dec 24, 2016 at 09:39 GMT Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/41


In this WebAR example, it always turn on the front device camera when this AR webpage opened on google chrome browser in my android phone. However I want to set the back device camera as the default camera. How should I do?

ThorstenBux commented 6 years ago

Comment by ascourtas Tuesday Jan 10, 2017 at 17:22 GMT


Pretty sure changing the default camera is done in-browser, not in your code.

ThorstenBux commented 6 years ago

Comment by ascourtas Tuesday Jan 10, 2017 at 17:25 GMT


Ah, although it looks like it may be different on mobile. Folks here seemed to be having the same issue as you: https://groups.google.com/forum/#!msg/discuss-webrtc/i07T1X_DY94/qW8j9fNSpz4J

If you scroll to the bottom, you'll see posts from 2016 on how to handle it.

ThorstenBux commented 6 years ago

Comment by DavideCapitola Thursday Jan 19, 2017 at 08:58 GMT


According to the forum, this is a possible solution. The issue is that it works for a video tag, but the video in the library is inserted inside a canvas.

Do you know how to solve this issue without adding code to the library?

ThorstenBux commented 6 years ago

Comment by DavideCapitola Thursday Jan 19, 2017 at 16:59 GMT


I have tried the solution in this closed issue, but it is still not working on Galaxy S6 with Android 6.0.1

ThorstenBux commented 6 years ago

Comment by sdwolf Tuesday Mar 28, 2017 at 20:00 GMT


@DavideCapitola see #53 and https://github.com/sdwolf/ar-experiment for a working solution.

ThorstenBux commented 6 years ago

I was able to select the camera on mobile using facingMode option:


        The configuration object supports the following attributes:

            {
                onSuccess : function(video),
                onError : function(error),

                width : number | {min: number, max: number},
                height : number | {min: number, max: number},

                facingMode : 'environment' | 'user' | 'left' | 'right' | { exact: 'environment' | ... }
                deviceId : string | {exact: 'string'}
            }