Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android WebRTC - Browser updates error #383

Closed
horiyahumaid opened this issue Jun 6, 2020 · 4 comments
Closed

Android WebRTC - Browser updates error #383

horiyahumaid opened this issue Jun 6, 2020 · 4 comments

Comments

@horiyahumaid
Copy link

horiyahumaid commented Jun 6, 2020

Screenshot_20200606_135754

how to solve this issue? i test it in different devices , same thing

the url is virtual meeting, need access to camera audio

Container(
height:700,
child:InAppWebView(
// initialUrl:"https://appr.tc/",
initialUrl:MeetingURL,
initialHeaders: {},
initialOptions:InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
mediaPlaybackRequiresUserGesture: false,
debuggingEnabled: true,
)
),
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
},
onLoadStart: (InAppWebViewController controller, String url) {
},
onLoadStop: (InAppWebViewController controller, String url) {

    },
    androidOnPermissionRequest:(InAppWebViewController controller, String origin, List<String> resources) async {
      print(origin);
      print(resources);
      return PermissionRequestResponse(resources: resources, action: PermissionRequestResponseAction.GRANT);
    }
),
@pichillilorenzo
Copy link
Owner

pichillilorenzo commented Jun 6, 2020

Can you give me the Android version and the Android device info that you used to test, please?
Also, if you inspect your device (set option debuggingEnabled: true) while it's running using this URL on your Chrome browser: chrome://inspect/#devices (see https://developers.google.com/web/tools/chrome-devtools/remote-debugging/webviews#open_a_webview_in_devtools), do you see any error??
Could you share the URL you are using for your meetings? What service are you using for your meetings?? thanks.

However, to request permissions about the camera and microphone, you can use the permission_handler plugin.

Also, you need to add these permissions in the AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"/>
<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.VIDEO_CAPTURE" />
<uses-permission android:name="android.permission.AUDIO_CAPTURE" />

Full code example that I tested on my real Android Device with Android 9:

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:permission_handler/permission_handler.dart';

Future main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Permission.camera.request();
  await Permission.microphone.request();

  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: InAppWebViewPage()
    );
  }
}

class InAppWebViewPage extends StatefulWidget {
  @override
  _InAppWebViewPageState createState() => new _InAppWebViewPageState();
}

class _InAppWebViewPageState extends State<InAppWebViewPage> {
  InAppWebViewController _webViewController;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
            title: Text("InAppWebView")
        ),
        body: Container(
            child: Column(children: <Widget>[
              Expanded(
                child: Container(
                  child: InAppWebView(
                      initialUrl: "https://appr.tc/r/704328056",
                      initialOptions: InAppWebViewGroupOptions(
                        crossPlatform: InAppWebViewOptions(
                          mediaPlaybackRequiresUserGesture: false,
                          debuggingEnabled: true,
                        ),
                      ),
                      onWebViewCreated: (InAppWebViewController controller) {
                        _webViewController = controller;
                      },
                      androidOnPermissionRequest: (InAppWebViewController controller, String origin, List<String> resources) async {
                        return PermissionRequestResponse(resources: resources, action: PermissionRequestResponseAction.GRANT);
                      }
                  ),
                ),
              ),
            ]))
    );
  }
}

This is the result:

webrtc-example

@pichillilorenzo pichillilorenzo changed the title Browser updates error Android WebRTC - Browser updates error Jun 6, 2020
@horiyahumaid
Copy link
Author

android studio version 4.0
Android Version in my device: 10
device name: Huawei mate 20 Pro

"chrome://inspect/#devices" i cant open it in my device got an error.

i try this url https://appr.tc/ it is working fine in my app , but my url is not working

in my url we r using Webrtc.
cant share my url because it is created for specific users only.

thank you for your response

@pichillilorenzo
Copy link
Owner

You need to open "chrome://inspect/#devices" on your computer using the Chrome browser.
Also, you need to enable USB debugging on your phone (see https://developer.android.com/studio/debug/dev-options).

If I can't access the URL, then it is quite difficult to me try to debug it.
If https://appr.tc/ is working fine, then there are some problems with your WebRTC service (JavaScript side) you are using. I don't know what your service requires to make it work.
On Android, WebRTC API is already supported by default from Android 5 LOLLIPOP (Android SDK 21).

Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants