简体   繁体   English

android Lollipop WebRTC WebView应用程序

[英]android lollipop webrtc webview app

He at all. 他一点都没有。 I try to test my app based on lollipop API 22 devices. 我尝试基于棒棒糖API 22设备测试我的应用程序。

As a test I make a webview and try to connect to url " https://appr.tc/r/xxxxx ". 作为测试,我进行了Webview并尝试连接到URL“ https://appr.tc/r/xxxxx ”。

As result in my webview I can see my front camera preview, the appr server messages (button named joint .... etc.) .. but if try to establish a RTC peer chat I obtain these error: 作为结果,在我的Web视图中,我可以看到我的前置摄像头预览,appr服务器消息(名为joint ..等的按钮)..但是,如果尝试建立RTC对等聊天,则会出现以下错误:

the page at https://appr.tc says: cannot create rtcpeerconnection: undefined is not a function https://appr.tc上的页面显示:无法创建rtcpeerconnection:undefined不是函数

I have these row on .grandle ... 我在.grandle上有这些行...

implementation 'org.webrtc:google-webrtc:1.0.+'

I have these manifest permission ... 我有这些明显的许可...

  <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <uses-feature android:name="android.hardware.location.gps" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" /> <uses-permission android:name="android.permission.RECORD_AUDIO"/> <uses-permission android:name="android.webkit.PermissionRequest" /> <meta-data android:name="android.webkit.WebView.MetricsOptOut" android:value="true" /> <meta-data android:name="android.webkit.WebView.EnableSafeBrowsing" android:value="true" /> 

and I have these java code for implement webview chrome ... 而且我有这些Java代码来实现webview chrome ...

 public class CameraViewFrag extends Fragment { private static final String TAG = "CameraViewFrag"; private WebView mWebView; private String url = "https://appr.tc/r/658450307"; private Button goOnButton; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_camera_view,container,false); goOnButton = (Button) view.findViewById(R.id.gotoButton); mWebView = (WebView) view.findViewById(R.id.webview); WebSettings webSettings = mWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setSupportMultipleWindows(true); webSettings.setAllowContentAccess(true); webSettings.setAllowFileAccessFromFileURLs(true); webSettings.setAllowUniversalAccessFromFileURLs(true); webSettings.setJavaScriptCanOpenWindowsAutomatically(true); webSettings.setLoadWithOverviewMode(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { webSettings.setSafeBrowsingEnabled(true); } goOnButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mWebView.getSettings().setLoadsImagesAutomatically(true); mWebView.getSettings().setLoadWithOverviewMode(true); mWebView.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY); mWebView.setScrollbarFadingEnabled(true); mWebView.getSettings().setAllowFileAccess(true); mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); mWebView.getSettings().setDomStorageEnabled(true); mWebView.getSettings().setAppCacheEnabled(true); mWebView.getSettings().setMediaPlaybackRequiresUserGesture(false); //carichiamo finalmete la url mWebView.setWebChromeClient(new WebChromeClient(){ // Need to accept permissions to use the camera @Override public void onPermissionRequest(final PermissionRequest request) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { request.grant(request.getResources()); } }); } }); mWebView.loadUrl(url); } }); return view; } } 

the cose is insight a fragment ..... 的目的是洞察力的片段.....

I do not see my mistake and I have not found an answer to this kind of error until now on stack neither on google.... 我看不到我的错误,并且直到现在我都没有在Google上找到此类错误的答案。...

sorry ... I add the interesting part of logcat: 抱歉...我添加了logcat的有趣部分:

 01-16 12:00:36.627 12598-12598/com.example.bleahkthe.test I/chromium: [INFO:CONSOLE(5590)] "4.864: Opening signaling channel.", source: https://appr.tc/js/apprtc.debug.js (5590) 01-16 12:00:37.007 12598-12598/com.example.bleahkthe.test I/chromium: [INFO:CONSOLE(5590)] "5.274: Joined the room.", source: https://appr.tc/js/apprtc.debug.js (5590) 01-16 12:00:37.169 12598-12598/com.example.bleahkthe.test I/chromium: [INFO:CONSOLE(5590)] "5.444: Signaling channel opened.", source: https://appr.tc/js/apprtc.debug.js (5590) 01-16 12:00:37.169 12598-12598/com.example.bleahkthe.test I/chromium: [INFO:CONSOLE(5590)] "5.445: Registering signaling channel.", source: https://appr.tc/js/apprtc.debug.js (5590) 01-16 12:00:37.171 12598-12598/com.example.bleahkthe.test I/chromium: [INFO:CONSOLE(5590)] "5.445: Signaling channel registered.", source: https://appr.tc/js/apprtc.debug.js (5590) 01-16 12:00:37.172 12598-12598/com.example.bleahkthe.test I/chromium: [INFO:CONSOLE(5590)] "5.450: Starting signaling.", source: https://appr.tc/js/apprtc.debug.js (5590) 01-16 12:00:37.173 12598-12598/com.example.bleahkthe.test I/chromium: [INFO:CONSOLE(5590)] "5.455: Creating RTCPeerConnnection with: config: '{"rtcpMuxPolicy":"require","bundlePolicy":"max-bundle","iceServers":[{"urls":["turn:74.125.143.127:19305?transport=udp","turn:[2607:f8b0:400d:c09::7f]:19305?transport=udp","turn:74.125.143.127:443?transport=tcp","turn:[2607:f8b0:400d:c09::7f]:443?transport=tcp"],"username":"CNDZ/NIFEgbJSf4StDgYzc/s6OMTIICjBQ","credential":"P6ssOSIPA2wBBQMHXiDa9BEsJUI="},{"urls":["stun:stun.l.google.com:19302"]}]}'; constraints: '{"optional":[]}'.", source: https://appr.tc/js/apprtc.debug.js (5590) 01-16 12:00:37.204 12598-12598/com.example.bleahkthe.test I/chromium: [INFO:CONSOLE(5590)] "5.487: Created PeerConnectionClient", source: https://appr.tc/js/apprtc.debug.js (5590) 01-16 12:00:37.207 12598-12598/com.example.bleahkthe.test I/chromium: [INFO:CONSOLE(5590)] "5.491: Adding local stream.", source: https://appr.tc/js/apprtc.debug.js (5590) 01-16 12:00:37.214 12598-12598/com.example.bleahkthe.test I/chromium: [INFO:CONSOLE(5590)] "5.499: Create PeerConnection exception: TypeError: undefined is not a function", source: https://appr.tc/js/apprtc.debug.js (5590) 01-16 12:00:37.296 12598-12615/com.example.bleahkthe.test D/ufoEGL: Pixel Format : GGL_PIXEL_FORMAT_RGBA_8888 01-16 12:00:39.710 12598-12615/com.example.bleahkthe.test D/ufoEGL: Surface destroy: ANDROID_NATIVE_WINDOW_MAGIC 01-16 12:00:39.714 12598-12615/com.example.bleahkthe.test D/OpenGLRenderer: endAllStagingAnimators on 0xce92f800 (RippleDrawable) with handle 0xde6cc030 01-16 12:00:46.322 12598-12615/com.example.bleahkthe.test D/ufoEGL: Pixel Format : GGL_PIXEL_FORMAT_RGBA_8888 01-16 12:00:48.255 12598-12598/com.example.bleahkthe.test I/art: Explicit concurrent mark sweep GC freed 47570(3MB) AllocSpace objects, 4(61KB) LOS objects, 40% free, 6MB/10MB, paused 695us total 54.479ms 01-16 12:00:48.260 12598-12598/com.example.bleahkthe.test I/art: System.exit called, status: 0 01-16 12:00:48.262 12598-12598/com.example.bleahkthe.test I/AndroidRuntime: VM exiting with result code 0, cleanup skipped. 

regards bkt 问候bkt

This happens because the webview takes property of the default browser and if the default one is not chrome then it is unsupported. 发生这种情况是因为webview具有默认浏览器的属性,如果默认浏览器不是chrome,则不受支持。 Ask for browsers to open the url. 要求浏览器打开URL。 and choose chrome to make the webrtc call. 并选择chrome进行webrtc调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM