I am facing the following problem: I have a website and a mobile flutter app displaying the website. Everything works fine until I try to upload a video from the photo library. The app goes into the white screen whenever I am trying to upload a video from the photo gallery. Moreover, the debugger loses connection and the Ajax Request (the upload is handled by the Ajax) is not proceeded. Uploading the video captured by the camera works fine.
It stops on the 'shouldInterceptAjaxRequest' and does not go any further:
[IOSInAppWebViewController] (iOS) WebView ID 0 calling "shouldInterceptAjaxRequest" using [{data: [45, 45, 45, 45, 45, 45, 87, 101, 98, 75, 105, 116, 70, 111, 114, 109, 66, 111, 117, 110, 100, 97, 114, 121, 74, 109, 87, 68, 113, 70, 100, 98, 51, 73, 105, 108, 102, 72, 82, 88, 13, 10, 67, 111, 110, 116, 101, 110, 116, 45, 68, 105, 115, 112, 111, 115, 105, 116, 105, 111, 110, 58, 32, 102, 111, 114, 109, 45, 100, 97, 116, 97, 59, 32, 110, 97, 109, 101, 61, 34, 102, 105, 108, 101, 34, 59, 32, 102, 105, 108, 101, 110, 97, 109, 101, 61, 34, 73, 77, 71, 95, 51, 54, 48, 50, 46, 109, 111, 118, 34, 13, 10, 67, 111, 110, 116, 101, 110, 116, 45, 84, 121, 112, 101, 58, 32, 118, 105, 100, 101, 111, 47, 113, 117, 105, 99, 107, 116, 105, 109, 101, 13, 10, 13, 10, 0, 0, 0, 20, 102, 116, 121, 112, 113, 116, 32, 32, 0, 0, 0, 0, 113, 116, 32, 32, 0, 0, 43, 215, 109, 111, 111, 118, 0, 0, 0, 108, 109, 118, 104, 100, 0, 0, 0, 0, 226, 36, 206, 240, 226, 36, 206, 243, 0, 0, 2, 88, 0, 0, 25, 120, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[IOSInAppWebViewController] (iOS) WebView ID 0 calling "onWebContentProcessDidTerminate" using {}
[IOSInAppWebViewController] (iOS) WebView ID 0 calling "onProgressChanged" using {progress: 0}
[IOSInAppWebViewController] (iOS) WebView ID 0 calling "onTitleChanged" using {title: }
After the Ajax Request the app executes 'onWebContentProcessDidTerminate'.
The debugger loses the connection with the devices.
Configuration:
Permissions:
import 'package:permission_handler/permission_handler.dart';
initPermissions() async {
await Permission.camera.request();
await Permission.photos.request();
await Permission.microphone.request();
await Permission.mediaLibrary.request();
await Permission.videos.request();
await Permission.storage.request();
await Permission.audio.request();
}
Podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=1',
## dart: PermissionGroup.microphone
'PERMISSION_MICROPHONE=1',
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=1',
## dart: PermissionGroup.mediaLibrary
'PERMISSION_MEDIA_LIBRARY=1',
]
end
end
end
Info.plist (part)
<key>NSCameraUsageDescription</key>
<string>Flutter requires access to camera.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Access to the microphone is required in order to record videos</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Your description on why app needs access to photos library</string>
<key>NSAppleMusicUsageDescription</key>
<string>desc</string>
I tried to change permissions and did a research around that. I have also tried reloading the controller when the 'onWebContentProcessDidTerminate' is executed. Also tried to batch the sent file on the Ajax side but it did not resolve the issue. The issue seemed to be resolved when the file is converted to Base64 string and sent to the server but that solution does not meet our requirements.
I found out that the video from the gallery would need to be moved to the sandbox - is it possible to do it inside of InAppWebView without workarounds?
Thanks!