0

I am building an application with BuildFire.JS, and my app uses WebRTC. I look through how BuildFire works, and it embeds the Widget inside an iFrame when the app is being displayed in the plug-in interface. The IFrame looks as such:

<iframe id="widget" style="height: 100%; width: 100%; padding-top: 49px;" ng-style="{'padding-top': showNavigationBar ? '49px' : '0px' }" class="pluginFrame" seamless="" allowfullscreen="" sandbox="allow-scripts allow-forms  allow-same-origin allow-popups" ng-src="http://localhost:8080/widget/index.html?fid=widget&amp;appcontext=%xxxxxxxx"></iframe>

For my WebRTC components work, I need the iframe in the plugin interface to have the following options:

<iframe allow="camera; microphone" ></iframe>

Otherwise the camera will be blocked. How can I added to the IFrame in BuildJS to allow access to the camera and mic?

Devin Dixon
  • 11,553
  • 24
  • 86
  • 167

2 Answers2

1

SDK 1.65.2 has now support for required allow attributes (Android, iOS, Plugin Tester) and native permission requests for Android and iOS

Check the following new SDK functions:

https://sdk.buildfire.com/docs/camera/#isauthorized https://sdk.buildfire.com/docs/camera/#requestauthorization

blue
  • 209
  • 1
  • 7
  • 1
    Quick note, I updated my Buildfire locally to 1.65.2 tested the plug-in and the features work. I then rebuilt my plug-in and uploaded to the site, and I still get permission denied. After inspecting the iframe, the camera/mic permissions are still not being allowed. – Devin Dixon Jul 27 '22 at 01:02
  • Here is a video of me replicating the issue: https://youtu.be/2wLE5YssthU – Devin Dixon Jul 27 '22 at 21:23
  • Changes were released to (Android, iOS, Plugin Tester). it is now released also to the emulator so you should be good now also on emulator @DevinDixon. – blue Jul 27 '22 at 22:06
  • @DevinDixon can you flag answers so others can benefit from them as you would ? – blue Aug 15 '22 at 17:21
-1

I am not sure if this is hacky or not, but to fix the issue I found the iframe was being generated in the file pluginTester/index.html

So I added the following to the iframe in the file, linke 153:

<iframe  allow="camera; microphone" id="widget" ng-src="{{widgetSrc}}" style="height:100%; width:100%;"  ng-style="{'padding-top': showNavigationBar ? '49px' : '0px' }" class="pluginFrame" seamless allowfullscreen sandbox="allow-scripts allow-forms  allow-same-origin allow-popups"></iframe>

Feels hacky but it worked. This won't carry over to other clients who don't do the same modification, it would be nice if the allow functionality could be set in a configuration option.

If anyone has a better way, Im all ears.

Devin Dixon
  • 11,553
  • 24
  • 86
  • 167
  • That will only work within your tester, but will not work within an app. – attila226 Jul 08 '22 at 21:28
  • @attila226 Can you explain the issue with it working in the App? – Devin Dixon Jul 09 '22 at 12:17
  • The file that you modified only exists within your local Plugin Tester. It is not part of your plugin and does not get deployed. Apps have their own internal files that you don't have access to, that contain the iframe. Instead BuildFire requires that you update your plugin.json file to specify the required permissions/features. (See more info in the link below.) Having said that, I'm not sure if BuildFire currently supports using the camera and mic. https://sdk.buildfire.com/docs/features-list – attila226 Jul 11 '22 at 16:16
  • Your solution is ok @d – blue Jul 14 '22 at 00:11
  • @blue it fixes it in the testing area but attila226 was right in that it doesn't work when actually deploying the app. – Devin Dixon Jul 14 '22 at 00:13
  • @DevinDixon Buildfire team is testing it out and will probably add it soon – blue Jul 14 '22 at 00:21
  • @blue because we specialize in WebRTC, is there anything we can do to assist the team in development? – Devin Dixon Jul 14 '22 at 12:39
  • @DevinDixon iOS seems to be good. However, for android NotReadableError is being received while using allow="camera; microphone". any pointers you can give ? – blue Jul 15 '22 at 00:25
  • @blue can you give a gist of the error? – Devin Dixon Jul 15 '22 at 04:25
  • 2
    @DevinDixon it was an android native permission issue. We are looking how to require permission programmatically and we will continue testing afterwards. – blue Jul 17 '22 at 22:56
  • @blue Just wanted to check back. Is there any time frame for a release? And do you need any support in testing? (as we are rolling it out to our clients on BuildFire, its mutually beneficial for us to test as well). – Devin Dixon Jul 20 '22 at 20:34
  • @DevinDixon it is looking good on our end. I expect it will be rolled out by next week – blue Jul 25 '22 at 19:23
  • Thanks @blue. Is there anyway we can beta or alpha test before it rolls out? – Devin Dixon Jul 26 '22 at 21:54
  • @DevinDixon you can test it live now. note that you will need your app rebuilt to gain access to the new native permissions request. – blue Jul 27 '22 at 00:13