# Please how do I gain access to a webcam using wix code or iframe?

**URL:** <https://forum.wixstudio.com/t/please-how-do-i-gain-access-to-a-webcam-using-wix-code-or-iframe/35156>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [August 8, 2021, 2:52pm UTC](https://forum.wixstudio.com/t/please-how-do-i-gain-access-to-a-webcam-using-wix-code-or-iframe/35156 "2021-08-08T14:52:11Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![Cue](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Cue](https://forum.wixstudio.com/u/Cue)\
**Post date:** [March 18, 2022, 10:12am UTC](https://forum.wixstudio.com/t/please-how-do-i-gain-access-to-a-webcam-using-wix-code-or-iframe/35156/21 "2022-03-18T10:12:40Z")

</div>

@onemoretime Yes the camera came on but Yisreal’s code did not attach the camera to the html and another html code that is meant to trigger the camera and attach it on button click returned the error

---

<div class="post-metadata">

**Author:** ![onemoretime](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/onemoretime/32/104023_2.png) [@onemoretime](https://forum.wixstudio.com/u/onemoretime)\
**Post date:** [March 18, 2022, 10:44am UTC](https://forum.wixstudio.com/t/please-how-do-i-gain-access-to-a-webcam-using-wix-code-or-iframe/35156/22 "2022-03-18T10:44:22Z")

</div>

camera came on!! 🙂

---

<div class="post-metadata">

**Author:** ![Cue](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Cue](https://forum.wixstudio.com/u/Cue)\
**Post date:** [March 18, 2022, 11:28am UTC](https://forum.wixstudio.com/t/please-how-do-i-gain-access-to-a-webcam-using-wix-code-or-iframe/35156/23 "2022-03-18T11:28:56Z")

</div>

@onemoretime But what is the point of the camera coming on if it cannot be attached to wix html or cannot be called by a button in wix html component?

---

<div class="post-metadata">

**Author:** ![Cue](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Cue](https://forum.wixstudio.com/u/Cue)\
**Post date:** [March 18, 2022, 3:35pm UTC](https://forum.wixstudio.com/t/please-how-do-i-gain-access-to-a-webcam-using-wix-code-or-iframe/35156/24 "2022-03-18T15:35:31Z")

</div>

@onemoretime Do you have the code for attaching the camera in wix?

---

<div class="post-metadata">

**Author:** ![onemoretime](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/onemoretime/32/104023_2.png) [@onemoretime](https://forum.wixstudio.com/u/onemoretime)\
**Post date:** [March 18, 2022, 3:44pm UTC](https://forum.wixstudio.com/t/please-how-do-i-gain-access-to-a-webcam-using-wix-code-or-iframe/35156/25 "2022-03-18T15:44:48Z")

</div>

@chidiejike Try limiting the HTML element to one and using getUserMedia () only once. I think it will not be called if you call it once before in another HTML so it can’t call again with the button.

---

<div class="post-metadata">

**Author:** ![Cue](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Cue](https://forum.wixstudio.com/u/Cue)\
**Post date:** [March 18, 2022, 5:33pm UTC](https://forum.wixstudio.com/t/please-how-do-i-gain-access-to-a-webcam-using-wix-code-or-iframe/35156/26 "2022-03-18T17:33:38Z")

</div>

I have not even gotten to that point, I am just tying to load the camera immediately the page loads but the camera is still not attaching to the html component. When this works then I can try to call with a button

---

<div class="post-metadata">

**Author:** ![onemoretime](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/onemoretime/32/104023_2.png) [@onemoretime](https://forum.wixstudio.com/u/onemoretime)\
**Post date:** [March 19, 2022, 1:15am UTC](https://forum.wixstudio.com/t/please-how-do-i-gain-access-to-a-webcam-using-wix-code-or-iframe/35156/27 "2022-03-19T01:15:21Z")

</div>

@chidiejike Please show me again your HTML code you just trying to work. And make sure it’s the only HTML on the page.

---

<div class="post-metadata">

**Author:** ![Cue](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Cue](https://forum.wixstudio.com/u/Cue)\
**Post date:** [March 19, 2022, 4:55am UTC](https://forum.wixstudio.com/t/please-how-do-i-gain-access-to-a-webcam-using-wix-code-or-iframe/35156/28 "2022-03-19T04:55:32Z")

</div>

@onemoretime I used your last code in the wix custom code in the dashboard the used Yisreal last code for my html compnent

---

<div class="post-metadata">

**Author:** ![Cue](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Cue](https://forum.wixstudio.com/u/Cue)\
**Post date:** [March 23, 2022, 10:19pm UTC](https://forum.wixstudio.com/t/please-how-do-i-gain-access-to-a-webcam-using-wix-code-or-iframe/35156/29 "2022-03-23T22:19:23Z")

</div>

How do we make this work in mobile browsers? This works on Chrome Desktop but not on Chrome

---

<div class="post-metadata">

**Author:** ![Cue](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Cue](https://forum.wixstudio.com/u/Cue)\
**Post date:** [April 22, 2022, 11:22pm UTC](https://forum.wixstudio.com/t/please-how-do-i-gain-access-to-a-webcam-using-wix-code-or-iframe/35156/30 "2022-04-22T23:22:17Z")

</div>

You guys should stop misleading people this solution does not work, it has never worked, no point as tagging it as “SOLVED”, rather it should be tagged “UNSOLVED”.

---

<div class="post-metadata">

**Author:** ![onemoretime](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/onemoretime/32/104023_2.png) [@onemoretime](https://forum.wixstudio.com/u/onemoretime)\
**Post date:** [May 16, 2022, 7:12am UTC](https://forum.wixstudio.com/t/please-how-do-i-gain-access-to-a-webcam-using-wix-code-or-iframe/35156/31 "2022-05-16T07:12:23Z")

</div>

@chidiejike hey, I noticed we can use navigator.mediaDevices.getUserMedia() in the Custom Element.

from this article.

> **[iframe allow attribute not working on mobile browsers | Velo by Wix](https://community.wix.com/velo/forum/coding-with-velo/iframe-allow-attribute-not-working-on-mobile-browsers)**
>
> Need to give permission to use the microphone on a website using the iframe allow setattribute. it works but not on most mobile (tested and works on samsung browser but not chrome, safari etc)
> 
> Big shout out to Yisrael as this is essentially his...

I referred to J.D.'s advice. I hope this will help you!

---

<div class="post-metadata">

**Author:** ![Cue](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Cue](https://forum.wixstudio.com/u/Cue)\
**Post date:** [June 23, 2022, 2:18pm UTC](https://forum.wixstudio.com/t/please-how-do-i-gain-access-to-a-webcam-using-wix-code-or-iframe/35156/32 "2022-06-23T14:18:21Z")

</div>

Is there any video on how to use this custom element? Knowing fully well that the html enbed has massive limits, why can’t wix just create a video on how to transfer your html,js,css in the html embed to custom element?

---

<div class="post-metadata">

**Author:** ![Eddie\_Monroe](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/eddie_monroe/32/82242_2.png) [@Eddie\_Monroe](https://forum.wixstudio.com/u/Eddie_Monroe)\
**Post date:** [July 26, 2024, 5:49pm UTC](https://forum.wixstudio.com/t/please-how-do-i-gain-access-to-a-webcam-using-wix-code-or-iframe/35156/33 "2024-07-26T17:49:35Z")

</div>

This worked for me. Thank you!

[Previous page](https://forum.wixstudio.com/t/please-how-do-i-gain-access-to-a-webcam-using-wix-code-or-iframe/35156.md?page=1)
