If you want to use VideoAsk in your native mobile application, here's what you need to know.
Videoasks can be used in native mobile apps by loading them in WebViews. Add the parameters and settings described below to your native app for an optimal experience with VideoAsk video and audio recordings.
iOS instructions
Use a WKWebView
with the following settings:
- Set
allowsInlineMediaPlayback
totrue
: https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1614793-allowsinlinemediaplayback - Set
mediaTypesRequiringUserActionForPlayback
toWKAudiovisualMediaTypeNone
: https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1851524-mediatypesrequiringuseractionfor -
Set a
uiDelegate
for theWKWebView
like this:wkWebView.uiDelegate = self
Then, add the following code so the app inherits the parent app's camera and microphone permissions:extension YourViewController: WKUIDelegate {
@available(iOS 15.0, *)
func webView(
_ webView: WKWebView,
decideMediaCapturePermissionsFor origin: WKSecurityOrigin,
initiatedBy frame: WKFrameInfo,
type: WKMediaCaptureType
) async -> WKPermissionDecision {
return .grant
}
}
The record button is hidden when opening a videoask in a WebView of my iOS app, so it makes it tricky for respondents to answer. How can I solve this?
This can be fixed by adding a little extra code to your embed code:
let configuration = WKWebViewConfiguration() configuration.allowsInlineMediaPlayback
= true
webView = WKWebView.init(frame: .zero,
configuration: configuration)
Android instructions
Use a WebView
with the following settings:
- Make sure that your app has access to
RECORD_AUDIO
,CAMERA
andWRITE_EXTERNAL_STORAGE
. Request permissions if it doesn't. - Set
webview.settings.javaScriptEnabled
totrue
. - You can override
webViewClient
'sshouldOverrideUrlLoading
to returntrue
. - You should override
webChromeClient
'sonPermissionRequest
to automatically grant permissions.
You can find a complete example here.
To detect that a videoask was completed, use the Redirect to URL feature to send users to a URL on completion, and listen to the URL change event.