使用Angular 6的angular2-qrscanner无法在WebView for mobile中打开相机

时间:2019-09-19 13:37:47

标签: android angular webview android-webview

我已经使用angular2-qrscanner(Angular 6)开发了QR码读取解决方案,并且在浏览器上运行良好。然后,我们创建了一个android apk,它在webview中打开相同的角度解,但是我得到了E / chromium:[ERROR:web_contents_delegate.cc(203)] WebContentsDelegate :: CheckMediaAccessPermission:不支持。错误

对于角度https://github.com/goergch/angular2-qrscanner

webview.setWebChromeClient(new WebChromeClient());
webview.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        webview.setOverScrollMode(WebView.OVER_SCROLL_NEVER);
        webview.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
        WebSettings webSettings = webview.getSettings();
        webSettings.setMediaPlaybackRequiresUserGesture(false);
        webSettings.setLoadsImagesAutomatically(true);
        webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
        webSettings.setDomStorageEnabled(true);
        webSettings.setJavaScriptEnabled(true);
        webSettings.setAllowFileAccess(true);
        webSettings.setPluginState(WebSettings.PluginState.ON_DEMAND);
        webSettings.setLoadWithOverviewMode(true);
        webSettings.setUseWideViewPort(true);

<uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.CAPTURE_SECURE_VIDEO_OUTPUT"
        tools:ignore="ProtectedPermissions" />
    <uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT"
        tools:ignore="ProtectedPermissions" />
    <uses-permission android:name="android.permission.CAPTURE_AUDIO_OUTPUT"
        tools:ignore="ProtectedPermissions" />


    <application
        android:name=".Application"
        android:allowBackup="true"
        android:icon="@drawable/app_icon"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:hardwareAccelerated="true" >

0 个答案:

没有答案