Sunday, March 24, 2024
HomeiOS DevelopmentFlutter InAppWebView iOS: Importing Video from the Picture Gallery causes WebContent to...

Flutter InAppWebView iOS: Importing Video from the Picture Gallery causes WebContent to be terminated


I’m dealing with the next drawback:
I’ve a web site and a cellular flutter app displaying the web site. All the things works effective till I attempt to add a video from the picture library.
The app goes into the white display every time I’m attempting to add a video from the picture gallery. Furthermore, the debugger loses connection and the Ajax Request (the add is dealt with by the Ajax) will not be proceeded. Importing the video captured by the digicam works effective.

It stops on the ‘shouldInterceptAjaxRequest’ and doesn’t go any additional:

[IOSInAppWebViewController] (iOS) WebView ID 0 calling "shouldInterceptAjaxRequest" utilizing [{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" utilizing {}
[IOSInAppWebViewController] (iOS) WebView ID 0 calling "onProgressChanged" utilizing {progress: 0}
[IOSInAppWebViewController] (iOS) WebView ID 0 calling "onTitleChanged" utilizing {title: }

After the Ajax Request the app executes ‘onWebContentProcessDidTerminate’.

The debugger loses the reference to the gadgets.

Configuration:

Permissions:

import 'package deal:permission_handler/permission_handler.dart';

initPermissions() async {
    await Permission.digicam.request();
    await Permission.photographs.request();
    await Permission.microphone.request();
    await Permission.mediaLibrary.request();
    await Permission.movies.request();
    await Permission.storage.request();
    await Permission.audio.request();
}

Podfile:

post_install do |installer|
  installer.pods_project.targets.every do |goal|
    flutter_additional_ios_build_settings(goal)
    goal.build_configurations.every 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',
      ]
    finish
  finish
finish

Information.plist (half)

<key>NSCameraUsageDescription</key>
<string>Flutter requires entry to digicam.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Entry to the microphone is required so as to report movies</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Your description on why app wants entry to photographs library</string>
<key>NSAppleMusicUsageDescription</key>
<string>desc</string>

I attempted to alter permissions and did a analysis round that. I’ve additionally tried reloading the controller when the ‘onWebContentProcessDidTerminate’ is executed. Additionally tried to batch the despatched file on the Ajax aspect nevertheless it didn’t resolve the problem. The difficulty gave the impression to be resolved when the file is transformed to Base64 string and despatched to the server however that answer doesn’t meet our necessities.

I discovered that the video from the gallery would must be moved to the sandbox – is it attainable to do it within InAppWebView with out workarounds?

Thanks!



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments