The original problem: we’re unable to add an iframe in an html component to our sites that accesses the camera and microphone. The cause of this is two-fold as I understand. First, wix wraps our iframe inside its own iframe wrapper. While our iframe includes the allow microphone; camera, the wrapper iframe does not. Second, browsers have begun requiring iframe to explicitly allow use of mic & camera.
Almost a year ago, I stumbled upon a means of adding the the required “allow mic; camera” to the wrapper iframe by adding the following code to the Body-end via the Tracking & Analytics page:
Now here’s the new problem. This solution quit working in the past week. My question for the group is why? It appears that this code is simply no longer being executed. I’ve verified the code is still in the body-end of the page by viewing the page source. It’s just not adding the “allow” as it used to. Can anyone shed light on this?
UPDATE: Until recently, my pages successfully accessed the mic and camera, then something changed. The code is still executing but something has changed in how these iframes are served. I discovered that at the time this code is executed in the bodyend, the iframes are not yet in the DOM. By inserting a 3 second delay in the code, the iframe is once again found and the allow attribute is added.
There is a second mystery here. This now works (I can access camera and mic) on Safari but NOT Chrome/Firefox/Edge.
Any ideas on what changed and how to claim access to mic and camera from our wix pages?
SOLVED: In case anyone is interested, I resolved my issue. In addition to the delay (which is a total hack but I don’t know an alternative), rather than just add the allow attribute to the wix-added iframe, the code now:
creates a NEW iframe with the appropriate src and other attributes,
appendChild this iframe to the parentNode of the wix-added frame
remove the wix-added iframe
This essentially replaces the wix sandbox iframe with the iframe I wanted in the first place. Mic and camera work flawlessly.
Hi dwight , or someone who has been able to find a solution. We have tried to implement your solution using the code that we came up based on your broad description. The 3 sec delay works fin with Safari, but we are out of luck when trying chrome, even after implementing the NEW solution that you described. It would be awesome if you can confirm or identify what we may be missing in our code below. We implemented this code in all pages, in the body end via the Custom Code section:
Hi everyone. I m also trying to figure out a way to access mic through my iframe. I came across an app in wix marketplace that allows user to record audio messages. It’s interesting to see how so many people are struggling with the mic access issue and and app is achieving the same thing easily. Any idea how I can utilize this app to fashion a new feature on my site?
Hi, I still can not make it works using your code (copy your code then added the under the “Tracking & Analytics” section of the dashboard as part of Body-End, set it to add code to “all Pages” and to “Load code once”). So I want to ask does microphone and camera still work on your website? Thanks!
I’ve been going through this issue for almost a year now… from not working - to finding a solution - to not working again - finding another solution - to not working again. This is beyond frustrating. Has anyone figured what the core problem is and what - if any - more lasting fix can be applied.