Custom permission request UI?

Need to customise the current permissions ui, is there a way to change the current UI or repurpose the zappar-permission-ui component such that we can change just the css elements rather than creating an A-frame element.
Tried the permissions api which works perfectly with the prompt, granted state events but the api is not yet usable with safari so a similar workaround is needed.

Hey @mihir,

Modifying the default UI with just css would be a little tricky and limited, I do have a fairly simple alternative for you though (which does involve a custom component).

The permissions component uses ZapparThree.permissionRequestUI() under the hood, which displays the default permissions UI. You could create your own version of this component using:

ZapparThree.permissionRequest()

If you’d rather show your own permissions UI, you can use the following function to trigger the browser’s permission prompts directly. The function returns a promise that resolves to true if the user granted all the necessary permissions, otherwise false . Please note - due to browser restrictions, this function must be called from within a user event, e.g. in the event handler of a button click.

For reference, here’s the implementation of the permission request component.

More docs on permissions here.

Best of luck! :slight_smile:

Thank you @Deim, will surely check it out.
@Deim we did try the above method for unity using the unity permissions.cs as reference & some scripts provided in the forum threads.
here is a glitch for it: https://glitch.com/edit/#!/permission-ui-test

There was one bug where after allowing the camera access once and reloading the page would show the grant access prompt again. I have added some comments in the permission.js file for recreating the bug.

The above bug was fixed using permissions API which did work very efficiently but the api is not yet compatible with IOS Safari browser as it is not supported in safari yet.
Any suggestions on how can we fix this bug?

I’m afraid the permissions on iOS are not persistent, so there’s not much we can do at the moment.

Internally, PermissionRequestUI queries the permissions in pretty much the same way you are here. If they are already granted, it early exits (not appending any UI). I think that’s the only piece you’re missing here, unless I’ve missed something! :slight_smile:

1 Like

We are using Playcanvas for the 3D and integrate with Zappar,so I’d like to know how to change the message contents or obtain the privilege use the Zappar sdk of playcanvas?Or is there anyway else to make it?

thanks