user5599807 user5599807 - 3 months ago 121
Android Question

WebView WebRTC not working

I'm trying to show

WebRTC
chat in
WebView
.
Related to this documentation
WebView v36
supports
WebRTC
. For my test
i'm using device with
Chrome/39.0.0.0
and added permissins to manifest:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<user-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />


but when entered into chat see chromium error in the log (device doesn't show \ translate anything, only 'loading' progress bar):

W/AudioManagerAndroid: Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO
W/AudioManagerAndroid: No audio device will be available for recording
E/chromium: [ERROR:web_contents_delegate.cc(178)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
E/chromium: [ERROR:web_contents_delegate.cc(178)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
W/AudioManagerAndroid: Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO
W/AudioManagerAndroid: No audio device will be available for recording
D/ChromiumCameraInfo: Camera enumerated: front


tested on real device, Android 5.1.1

Answer

additional request for permissions is needed

webView.setWebChromeClient(new WebChromeClient(){
        @TargetApi(Build.VERSION_CODES.LOLLIPOP)
        @Override
        public void onPermissionRequest(final PermissionRequest request) {
                request.grant(request.getResources());
        }
    });

update but it not working for audio capture

UPDATE found working google-sample code here