Automatically Select Rear Camera? (C3)

0 favourites
  • 9 posts
From the Asset Store
Simple and easily editable template for a dynamic camera that zooms in and out based on how far apart the players are.
  • I've been at this for 3 hours. Everything I find online is either the camera following the player (which I don't want) or the posts are 4 or more years old.

    Please, how do I get the phone to automatically select the rear camera?

    I have: On start of layout > User Media > Request Camera Source - then what do I put for source.

    Using C3

    Thank you

  • Have you seen Camera Input template?

    Loop through all media sources, find one with camera facing back (UserMedia.CameraSourceFacingAt(loopindex)), request camera source with this index.

  • Yes I've seen it, but that makes the user select the camera. I don't want anyone selecting a camera. I want the rear facing camera to automatically open so that demo doesn't help.

    I haven't found anything online that shows me exactly how to get the rear facing camera to automatically open when the layout is open.

    With this app it doesn't make any sense for the user to select the camera.

    So how do I get the rear facing camera to automatically open?

    Thank you.

  • That demo is still the right way to go. Just instead of having a dropdown list of sources, you can automatically look through the list and find a source with the name "back" in it somewhere, when the user clicks "get camera". Although note that for security reasons you can't access the names of the camera devices until the user has approved camera input previously on that site... so you can only do the automatic picking on subsequent visits. I think given that restriction, it probably is easiest just to show the user a dropdown...

  • Thank you for your reply.

    Asking for permission seems to be automatic, at least for the selfie camera.

    Note: I'm using the remote play option (the QR code).

    Right now, the app opens and automatically asked for permission to use the camera, but it asked to use the selfie camera.

    Thus far all I have for code is On start of layout > Request camera. And that brings up the selfie camera automatically without anything else except the permissions that was automatically generated by Android.

    What I'm wondering is what I need to put in source so instead of automatically going for the selfie camera it looks for the rear camera.

    Below is the only line of code right now and all of it works, it's just the wrong camera. There has to be a simple way to tell it, rear camera, not selfie camera, right?

  • Yeah, you can find a "back" camera source by searching the source list, as I suggested. The camera input demo shows you how to access the list.

    The actual descriptions of the camera sources are only available after you've already approved permission though. Since remote preview runs on, if you've ever approved camera on, you'll be able to access the descriptions. However if you publish to your own website (e.g., the first time you visit that the descriptions will be anonymised for security reasons.

  • Actually I think this can be done better if we add a "facing mode" parameter to the "request camera" action. It should be straightforward and avoids having to deal with the quirks of the source list. I'll see if I can get that in for the next beta cycle.

  • I would love 2 options for 'Source': selfie and rear, but I'm a bit lazy lol

    Thanks for your help.

    I'm muddling through. I'll keep you posted.

    Thanks again.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • PS. I LOVE this software!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)