I am getting the browser old error on flutter webview, how can I solve it?

1.9k views Asked by At

I am preparing a webview application for a site with a distance education system. The infrastructure of the site is moodle and bigbluebutton is used for live lessons. When we click live lesson, I get an error when the browser is old version please use new version. Bigblubutton works in the healthiest chrome. I added the chrome infrastructure using the flutter_inappwebview plugin, but I still get the same error. I'm leaving the sample url below. I would be glad if you could help. bigbluebutton: https://test.bigbluebutton.org/ plugin I use: https://pub.dev/packages/flutter_inappwebview

full code

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

class MyInAppBrowser extends InAppBrowser {

  @override
  Future onLoadStart(String url) async {
    print("\n\nStarted $url\n\n");
  }

  @override
  Future onLoadStop(String url) async {
    print("\n\nStopped $url\n\n");
  }

  @override
  void onLoadError(String url, int code, String message) {
    print("\n\nCan't load $url.. Error: $message\n\n");
  }

  @override
  void onExit() {
    print("\n\nBrowser closed!\n\n");
  }

}

class MyChromeSafariBrowser extends ChromeSafariBrowser {

  MyChromeSafariBrowser(browserFallback) : super(bFallback: browserFallback);

  @override
  void onOpened() {
    print("ChromeSafari browser opened");
  }

  @override
  void onCompletedInitialLoad() {
    print("ChromeSafari browser initial load completed");
  }

  @override
  void onClosed() {
    print("ChromeSafari browser closed");
  }
}

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(
    new MyApp(),
  );
}

class MyApp extends StatefulWidget {
  final ChromeSafariBrowser browser = new MyChromeSafariBrowser(new MyInAppBrowser());

  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    widget.browser.addMenuItem(new ChromeSafariBrowserMenuItem(id: 1, label: 'Custom item menu 1', action: (url, title) {
      print('Custom item menu 1 clicked!');
      print(url);
      print(title);
    }));
    widget.browser.addMenuItem(new ChromeSafariBrowserMenuItem(id: 2, label: 'Custom item menu 2', action: (url, title) {
      print('Custom item menu 2 clicked!');
      print(url);
      print(title);
    }));
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('ChromeSafariBrowser Example'),
        ),
        body: Center(
          child: RaisedButton(
              onPressed: () async {
                await widget.browser.open(
                    url: "https://test.bigbluebutton.org/",
                    options: ChromeSafariBrowserClassOptions(
                        android:
                        AndroidChromeCustomTabsOptions(addDefaultShareMenuItem: false,
                            enableUrlBarHiding: true,
                            packageName: "com.android.chrome"),
                        ios: IOSSafariOptions(barCollapsingEnabled: true)));
              },
              child: Text("Open Chrome Safari Browser")),
        ),
      ),
    );
  }
}

 
2

There are 2 answers

1
Akif On

Don't worry about your code. This issue has been closed on Github because of the design of the website, BigBlueButton. You can continue successfully with other websites.

0
Bestami ARACI On

I fixed the problem by adding the code below. However, the videos do not open again in moodle.

 userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36",