# Add photo/video frame to only front camera capture

**URL:** <https://forum.8thwall.com/t/add-photo-video-frame-to-only-front-camera-capture/774>\
**Category:** Technical Support\
**Tags:** ar-camera, mediarecorder\
**Created:** [March 18, 2024, 3:31pm UTC](https://forum.8thwall.com/t/add-photo-video-frame-to-only-front-camera-capture/774 "2024-03-18T15:31:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andres\_Salomon](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/andres_salomon/32/390_2.png) [@Andres\_Salomon](https://forum.8thwall.com/u/Andres_Salomon)\
**Post date:** [March 18, 2024, 3:31pm UTC](https://forum.8thwall.com/t/add-photo-video-frame-to-only-front-camera-capture/774/1 "2024-03-18T15:31:54Z")

</div>

Hi guys! Is possible to implement this photo frame [A-Frame: Photo Frame | 8th Wall Playground | 8th Wall](https://www.8thwall.com/playground/photo-frame/code/) to only the photo/video capture with front camera? I don’t want that the back camera to have this. In other words, is there a way to detect the camera from what the photo/video is taken/recorded?

---

<div class="post-metadata">

**Author:** ![mihir\_m](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/mihir_m/32/131_2.png) [@mihir\_m](https://forum.8thwall.com/u/mihir_m)\
**Post date:** [March 20, 2024, 5:47am UTC](https://forum.8thwall.com/t/add-photo-video-frame-to-only-front-camera-capture/774/2 "2024-03-20T05:47:47Z")

</div>

@Andres_Salomon `xrface` always opens up the front camera by default as is in the project mentioned in your question.  
According to [docs](https://www.8thwall.com/docs/api/aframe/) you can configure the `cameraDirection` to either ‘front’ or ‘back’ based on your use case.

---

<div class="post-metadata">

**Author:** ![Andres\_Salomon](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/andres_salomon/32/390_2.png) [@Andres\_Salomon](https://forum.8thwall.com/u/Andres_Salomon)\
**Post date:** [March 20, 2024, 12:59pm UTC](https://forum.8thwall.com/t/add-photo-video-frame-to-only-front-camera-capture/774/3 "2024-03-20T12:59:03Z")

</div>

Hi @mihir_m ! Yeah I understand what you are saying, but maybe I didn’t explain correctly my need.

I have an experience where I use back camera and front camera (I switch between them) and I want only to apply that kind of frame and other stuffs to **only** the capture from front camera!

---

<div class="post-metadata">

**Author:** ![mihir\_m](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/mihir_m/32/131_2.png) [@mihir\_m](https://forum.8thwall.com/u/mihir_m)\
**Post date:** [March 20, 2024, 5:18pm UTC](https://forum.8thwall.com/t/add-photo-video-frame-to-only-front-camera-capture/774/4 "2024-03-20T17:18:55Z")

</div>

Assuming that you are using an event like click to switch to front or back camera, you could enable the frame on user click for front camera and remove the frame when user switches to back camera.  
You can set style.display to none for the image on this line [A-Frame: Photo Frame | 8th Wall Playground | 8th Wall](https://www.8thwall.com/playground/photo-frame/code/app.js#L16)

---

<div class="post-metadata">

**Author:** ![Andres\_Salomon](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.8thwall.com/andres_salomon/32/390_2.png) [@Andres\_Salomon](https://forum.8thwall.com/u/Andres_Salomon)\
**Post date:** [March 20, 2024, 7:53pm UTC](https://forum.8thwall.com/t/add-photo-video-frame-to-only-front-camera-capture/774/5 "2024-03-20T19:53:10Z")

</div>

Yeap, I switch between cameras with a click. So, I can execute method1 (like the one in the example) in a component, not in app.js? Asking because I thought it was something that you have to do when starting the application (where app.js is executed).

I mean, can I execute this every time I want?:

```auto
const onxrextrasloaded = () => {
  method1()
}

window.XRExtras ? onxrextrasloaded() : window.addEventListener('xrextrasloaded', onxrextrasloaded)

```
